#NCERT Solutions for Class 12 Computer Science (Python)
Explore tagged Tumblr posts
Text
Online Classes in UAE: Flexible Learning for a Busy Lifestyle

Are you looking to enhance your skills or pursue new interests, but struggling to fit traditional classroom schedules into your busy life? Online classes offer a convenient and flexible solution for individuals residing in the UAE. With Scholartuitions, you can access high-quality education from the comfort of your home, at a time that suits your schedule.
Why Choose Online Classes with Scholartuitions?
Flexibility: Study at your own pace and convenience, without the constraints of commuting or fixed classroom hours.
Accessibility: Access a wide range of courses from top-tier institutions and educators around the globe.
Personalized Learning: Benefit from tailored instruction and support, ensuring you get the most out of your online learning experience.
Affordable Options: Explore a variety of courses and programs to suit your budget and educational goals.
Quality Assurance: Scholartuitions partners with reputable institutions to deliver high-quality online courses and certifications.
Popular Online Courses in the UAE:
Languages: IELTS, Spoken English, French, German, Spanish, Hindi
Computer Science: WordPress, PHP, Java, Python, Shopify
Marketing: SEO, SMM, PPC
K-12 Academics: CBSE, ICSE, IB, IGCSE Boards, All Classes, All Subjects
Arts & Activities: Art & Crafts, Musical Instruments, Fusion Dancing
Other: Abacus, Chess, Mental Mathâs, Calligraphy, Story Telling, NCERT, IIT-JEE, NEET, Other Competitive Exams Preparation
Contact us for more information: https://scholartuitions.com/uae/
How Online Classes Can Benefit Your Lifestyle:
Time Management: Study at your own pace and schedule, making the most of your free time.
Work-Life Balance: Juggle your career and personal life more effectively by studying online.
Cost-Effective: Save on transportation, childcare, and other expenses associated with traditional classroom learning.
Comfort: Learn from the comfort of your own home, eliminating the need for commuting.
Getting Started with Scholartuitions:
Browse our course catalog: Discover a wide range of online courses and programs that align with your interests and goals.
Enroll in your desired course: Complete the enrollment process and gain access to course materials and resources.
Connect with your instructor: Engage with your instructor and classmates through online forums, video conferencing, and other interactive tools.
Complete your coursework: Submit assignments, participate in discussions, and complete assessments as required.
Earn your certification: Upon successful completion, receive a recognized certificate or credential.
Elevate Your Education with Scholartuitions
Ready to unlock the potential of online learning? Join the thousands of students in the UAE who have benefited from our affordable and effective online classes.
#Dance Education#Online Dance Studio#Online Classes For Spanish Language#Online Classes For German Language#Online Classes For French Language#Online Classes For Language#Online Classes For English Speaking#Best Online Coaching#Online Classes#Online Courses#CBSE#ICSE#IGCSE#Guitar Classes#Rubik's Cube#Mental Mathâs#Dancing Classes
0 notes
Text
NCERT Solutions Class 11 Computer Science Free PDF Download
To free download NCERT Questions and answers of NCERT Books All Classes Physics, Chemistry, Biology, History, Political Science, Economics, Geography, Computer Science, Accountancy, Business Studies, Hindi, English, Mathematics, EVS, Â Social Science and Home Science; do check NCERTPREP website. This site provides sample papers with solution, test papers for chapter-wise practice, NCERT book solution, NCERT Exemplar solutions, quick revision notes for ready reference, CBSE guess papers and CBSE important question papers. Sample Paper all are made available through the best app for CBSE students and NCERTPREP website.
Class 11 NCERT Solution Computer Science Python includes all the questions given in NCERT Books for all Subject. Here all questions are solved with detailed information and available for free to check. NCERT Solutions Class 11 Computer Science Python are given here for all chapter wise. Select the subject and choose chapter to view NCERT Solution chapter wise.
Computer Science is a practical subject. Â Deriving every answer on your own is a tedious task. Most of the students find it difficult to solve the problems or the practice exercise of the NCERT textbook difficult. So, whatâs the best way out? The best way is to have a solution book. The first unit comprises of computer fundamentals, software concepts, data representation, microprocessor, and memory. The basics of Operating systems and some common algorithms are dealt with here. Â The data representation is the main and very important chapter of computer science.
The main concept of binary numbers and how they are stored in computer memory is well explained. A student should learn to convert a decimal number into binary and vice versa. Practice the question given at the end of your NCERT books and verify the answer from the solution book.
The solution book also explains step by step how the answer has been derived. All the concepts related to microprocessors such as Instructions sets, 8085, and 8086 microprocessors have been explained in the fourth chapter.
Moving over to the next unit i.e. program methodology teaches us how to write any language in syntax. How the comments are used and why writing comments is very important in coding. The next chapter algorithms and flowcharts throw light over modular and structured programming. The various operators such as AND, OR, and NOT have been discussed in detail over here.
The third and the fourth unit deals with the language âPYTHONâ. Python is a programming language basically the most trending and acceptable language in todayâs world. You can build anything to everything by using pythonâs libraries and tools. It is used in web development, Blockchain development, somewhere in AI and ML as well. Itâs a very easy language with many active communities worldwide. It has been rated as 5/5 over the user-friendly ratings.
The third unit basically teaches you the basics of python, the operators, functions, and loops. The fifth unit calls for some nice coding skills. A solution book helps a student in the right kind of logic building so that the code development process goes clear in the kind of a student
NCERT Solutions of NCERT Books All Classes for CBSE class 3, 4, 5, 6, 7, 8, 9, 10, 11 & 12 are very helpful to students. Although, NCERT solutions contain only chapter-end questions and answers yet these are considered as key questions. Most of the questions in exams are either same or similar to these questions. So, it is advised that students must go through the NCERT Text Books and practice all the questions given at the end of the chapter. These questions will clear their basic doubts. We also recommend students should read the whole NCERT book line by line and prepare notes from NCERT books. It is always recommended to study NCERT books as it covers the whole syllabus. These questions with detailed explanation are now available in NCERTPREP.com for free to view and download.
First of all, Student must understand that NCERT textbook answers are not enough for exam preparation. Therefore, they must take NCERT textbook question and answers as basic learning tools. These questions and answers are basically meant for understanding the concepts. NCERT textbooks are certainly a good source of quality content. Hence, it is expected that students should not settle for chapter end questions only rather they should read the whole book thoroughly.NCERT Solution of NCERT Books All Classes are available in PDF format for free download. These ncert book chapter wise questions and answers are very helpful for CBSE exam. CBSE recommends NCERT books and most of the questions in CBSE exam are asked from NCERT textbooks.
We hope that our NCERT Solutions Class 11 Computer Science Python helped with your studies! If you liked our NCERT Solutions for Class 11, please share this post.
1 note
¡
View note
Text
NCERT Solutions for Computer Science
NCERT Solutions for Computer Science Class 11 NCERT Solutions for Class 11 Computer Science (Python) Network Automation Python Fundamentals Python Programming Fundamentals for Class 11 and 12 Class 12 NCERT Solutions for Class 12 Computer Science (C++) Chapterwise Question Bank CBSE Class 12 Computer Science (C++) Important Questions for Class 12 Computer Science (C++) Important âŚ
2 notes
¡
View notes
Text
How much does it cost to develop an e-learning app like Extra marks?
How much does it cost to develop an e-learning app like Extra marks?
E-Learning has evolved as a savior of life for students and teachers, especially during the Coronavirus Pandemic addict. This e-learning mobile application has changed the traditional method of educational processes throughout the world. When the spread of the Covid-19 pandemic has significantly affected the education segment. When there is no remaining option, people can continue their education outside the regular class settings only by efficient ways to induce results through e-learning applications.
About Extra marks:
Extra marks, an app with an enjoyable, thrilling, and collaborative way of eLearning with advanced features. It is unique in its way of precise via appealing visuals and amazing graphics, that resolve the queries within no time. Students can find innovative and accurate solutions for diverse topics on the app, via various graphics and collaborative learning segments, comprising projects, homework, tests, or assignments. Extra marks, is the only app that has solutions for all topics for all classes (KG to 12), for CBSE and ICSE Boards.
It has introduced an AI-supported study bot named Alex, which will aid students in learning the topics effectively at all times of need. You can easily click a picture of the queries of your choice and post it to get the answer.
Tailored Learning process This advanced bot crafts an innovative learning journey as it analyses the precise learning requirements and educational motives. It may employ surprise tests to understand the level of understanding, and adjust to the outcomes to meet the specific goals of the personalised learning process.
Another service called âAchieveâ offers practical clearing of doubts with comprehensive supervision. It is a special feature that lets teachers use SNAAP (Student Needs Analysis and Academic Profile) to guarantee success in every student's journey.
The complete process of learning at Extra marks is supported by an innovative Reports and Analytics platform. This is crucial in understanding individual and relative student performance. By recognizing the gaps and strengths in your learning process. The student will have access to view complete figures on key metrics such as average time consumed for every query, accuracy, understanding capacity, etc. You will get total understanding via comparative ranking and breakdown. Be guaranteed to utilize an innovative process at all your future subjects via suggestions and alterations as per learning curve necessities.
The app covers complete topics from KG to grade 12 with the same level of zeal and competitiveness. It is popular among several educational apps in the country, as it is the one-stop solution for diverse subjects such as Maths, Science, Social Science, English, English Core, English Elective, Sanskrit, Hindi, Economics, Geography, History, Political Science, Business Studies, Accountancy, Physics, Biology, Computer Science (C++ and Python), Chemistry, Informatics Practices, Multimedia Web and Technology, etc. All the learning methodologies and topics are affiliated with NCERT books and cover all subjects comprising NCERT Solutions.
How much does it cost to develop an e-learning app like Extra marks?
Developing an innovative learning app like Extra marks requires detailed research on various key features for determining the overall cost. The development cost of developing an eLearning app like Extra marks is generally reliant on the below key points:
Operating Platforms:
Building the app on diverse platforms involves the usage of diverse technological aspects. The development cost of building on the Android platform would need consideration of testing on multiple devices that will increase the overall cost of the iOS platform. Few business owners will opt for cross-platform development to reach users across multiple platforms.
Design:
It is key to offer an intuitive and user-friendly design to engage any kind of app user. With students interacting with the app for prolonged periods, a design with simple, smooth yet exciting navigations will engage them for longer. Also, the impactful design will reach the maximum number of users to get maximum profits.
App Features:
The size of the app is dependent on the type, amount, and complexity of features and functionalities in the app. Few of the included features will be basic and a few may be extra premium elements that will highly impact the overall development costs. These advanced features might require the with 3rd party integration to provide error-free service to the users. To ensure a safe move in the initial periods, it is suggested to include only basic features in the MVP versions.
Technologies:
The type of technology utilized in the app has a straight impact on the overall cost of development. Further few libraries and tools will have open-source components while others may require extra charges. Therefore, the selection of technologies will influence the overall cost of development hugely. This needs you to strategize much earlier for avoiding surprises at the last minute.
App Size:Â The overall cost of building an app such as Extra marks increases with the increase in the app size. App size increases exponentially with the inclusion of complex features and functionalities. Hence, with the increase in these elements, there will be a guaranteed increase in the app size. It is suggested only to select appropriate features that are relevant to the users.
Maintenance works:
It is key for any successful E Learning app development company to offer reliable coverage of app development services including maintenance service after the release of the app. Maintenance is key in the long-term success of the app as it runs without any flaws.
Selection of app Development Company:
The location, expertise, and guidance of the mobile app development company are highly important. A knowledgeable team will produce an excellent app at the expected interval but a slightly higher price.
Final Thoughts:
If you have understood the importance of an eLearning app such as Extra marks, then choose a reliable E Learning app development company in New Delhi like Brillmindz. The skilled team possesses unmatched experience and knowledge in creating profitable mobile apps across multiple industries. There will be a guaranteed success due to the right reach of the target audience and the use of accurate technologies.
0 notes
Link
Extramarks provide CBSE study material for computer science python which includes Introduction review of python, concepts of oops, exception handling, etc. These books are prepared by experts .The contents in NCERT Books are written in a simpler manner and can be easily understood.
0 notes
Video
LearnCBSE in NCERT Solutions for Class 12 Computer Science (Python)
0 notes
Text
NCERT Class 12 Computer Science (Python) Solutions
NCERT Class 12 Computer Science (Python) Solutions :: CBSE Board
UNIT â I : OBJECT ORIENTED PROGRAMMING WITH PYTHON
Chapter 1 Review of Python
Chapter 2 Object Oriented Programming Concepts
UNIT â II : ADVANCE PROGRAMMING WITH PYTHON
Chapter 3 Lists Manipulation and Implementation
UNIT â III : DATABASES MANAGEMENT SYSTEM AND SQL
Chapter 4 Database Concepts
Chapter 5 Structured Query Language
UNIT â IV : BOOLEAN ALGEBRA
Chapter 6 Boolean Algebra
UNIT â V : NETWORKING & OPEN SOURCE SOFTWARE COMMUNICATION TECHNOLOGIES
Chapter 7 Networking and Open Source Concepts
via Blogger https://ift.tt/3knPOPB
0 notes
Text
NCERT Class 12 Computer Science Chapter 7 Networking and Open Source Concepts
NCERT Class 12 Computer Science Python Solutions for Chapter 7 :: Networking and Open Source Concepts
TOPIC-1
Communication TechnologiesVery Short Answer Type Questions (1 Mark each)
Question 1:Identify the Domain name and URL from the following:https://ift.tt/2Rc5dG8Answer:Domain name â income.inURL â https://ift.tt/2Rc5dG8.
Question 2:What is web hosting?Answer:Web hosting is the service that makes our website available to be viewed by others on the Internet. A web host provides space on its server, so that other computers around the world can access our website by means of a network or modem.
Question 3:Write two characterstics of Wi-Fi.Answer:
It is wireless network.
It is for short range.
Question 4:Which protocol is used to creating a connection with a remote machine?Answer:Telnet:Â It is an older internet utility that lets us log on to remote computer system. It also facilitates for terminal emulation purpose.
Question 1:Which protocol is used to create a connection to a remote machine? Give any two advantages of using optical fibers.Answer:Two advantage of using optical fibers are:
Capable of extremely high-speed.
No electromagnetic interference.
Extremely low attending.
Question 6:Expand the following:
GSM
GPRS
Answer:
GSM:Â Global System for Mobile Commu-nication.
GPRS:Â General Packet Radio Service.
Question 7:What is the difference between packet and message switching ?Answer:
Question 8:What is cloud computing?Answer:The sharing of compute resources (dedicated, time-shared, or dynamically shared servers) and related infrastructure components (load balncers, firewalls, network storage, developer tools, monitors and management tools) to facilitate the deployment and operation of web and network based applications. Cloud computing relies on sharing of resources to achieve coherence and economies of scale, similar to a utility (like the electricity grid) over a net-work.
Question 9:Which type of network (out of LAN, PAN and MAN) is formed, when you connect two mobiles using Bluetooth to transfer a video?Answer:PAN
Question 10:Write one characterstic each for 2G and 3G mobile technologies.Answer:2G networks primarily involve the transmission of voice information, 3G technology provides the additional advantage of data transfer.
Question 11:What is the difference between Packet switching and circuit switching techniques?Answer:In circuit switching, a dedicated path exists from source to destination while in packet switching, there is no fixed path.
Question 12:Write two advantages of using an optical fibre cable over an Ethernet cable to connect two service stations, which are 200 m away from each other.Answer:Advantages of optical fibre:
Faster speed than ethernet
Lower attenuation
Question 13:Write one advantage of bus topology of network. Also illustrate how four (4) computers can be connected with each other using bus topology of network.Answer:Advantage (benefits) of linear Bus topology is that the cable length required for this topology is the least compared to the other networks.Bus Topology of Network:
Question 14:Give one suitable example of each URL and Domain Name.Answer:URL: http://waltons.inDomain Name: @gmail.com
Question 15:Write one advantage of star topology network? Also, illustrate how five (5) computers can be connected to each other using star topology of network.Answer:Advantage (benefits) of star toplogy:Easy to replace, install or remove hosts or other devices.
Question 16:What is the function of Modem?Answer:The function of modem is modulation and demo-dulation, means turn data into a format that can be transmitted via an audio link such as a phone line.
Question 17:Explain the purpose of a router.Answer:A router established connection between two networks and it can handle network with different protocols. Using a routing table, routers make sure that the data packets are travelling through the best possible paths to reach their destination.
Question 18:Name any two components required for net-working.Answer:
Repeater
Routers
Question 19:What are repeaters?Answer:A repeater is an electronic device that receives a signal and retransmits it at a higher level and/ or higher power, or onto the other side of an obstruction, so that the signal can cover longer distances.
Question 20:Mention one advantage of star topology over bus topology in networking?Answer:Simple to add more computers to network.
Question 21:Differentiate between packet swiching and message switching technique in network commu-nication.Answer:In packet switched network, data are transmitted in discrete units of potentially variable length blocks called packets, while in message switching mechanism, a node receives a message stores it until the appropriate route is free, then sends it along.
Question 22:Differentiate between Bus and Star topology of network.Answer:
Question 23:What is VoIP?Answer:Voice over Internet Protocol (VoIP) is one of a family of internet technologies, communication protocols, and transmission technologies for delivery of voice communications and multi-media sessions over internet protocol (IP) network, such as the internet.
Question 24:In networking, what is WAN? How is it different from LAN?Answer:WAN (Wide Area Network):A communication network that uses such devices as telephone lines, satellite, dishes, or radiowaves to span a larger geographic area which cannot be covered by a LAN.
Question 25:Define the term bandwidth. Give any one unit of bandwidth.Answer:Bandwidth is referred as the volume of information per unit of time that a transmission medium (like an internet connection) can handle.ORThe amount of data that can be transmitted in a fixed amount of time is known as bandwidth. For digital devices, the bandwidth is usually expressed in bits per second (bps) or bytes per second. For analog devices, the bandwidth is expressed in cycles per second, or Hertz (Hz).
Question 26:What is the difference between LAN and MAN?Answer:LAN:Â It is Local Area Network. The diameter is not more than a single building.WAN:Â It is Metropolitan Area Network. LAN spans a few kms while MAN spans 5-50 km diameter and is larger than a LAN.
Question 27:What is the importance of URL in networking ?Answer:A Uniform Resource Locator (URL) is used to specify, where an identified resource is available in the network and the mechanism for retrieving it. A URL is also referred to as a web address. 1
Question 28:What was the role of ARPANET in the computer network?Answer:In 1969, ARPANET was set up by the American government for defence purpose. ARPANET stands for Advanced research Projects agency Network.
Question 29:Which of the following is not a unit for data transfer rate ?
bps
abps
gbps
kbps
Answer:(ii) abps
Question 30:Identify the type of topology from the following:
Each node is connected with the help of a single cable
Each node is connected with the help of independent cable with central switching.
Answer:
Bus topology
Star topology
Question 31:ABC International School is planning to connect all computers, each spread over a distance of 50 metres. Suggest an economic cable type having high speed data transfer to connect these computers.Answer:Optical fibre cable.
Question 32:Mahesh wants to transfer data within a city at very high speed. Write the wired transmission medium and type of network.Answer:Wired transmission medium â Optical fibre cable Type of network â MAN.
Question 33:Which device is used to connect all computers inside a lab?Answer:Hub
Question 34:Which device is used to connect all computers to the internet using telephone wire?Answer:RJ â 45. It is an eight wired connectors used to connect computers on a LAN.
Question 35:What is Wi-Fi Card?Answer:Wi-Fi cards are small and portable cards that allow the computer to connect to the internet through a wireless network. The transmission is through the use of radio waves.
Short Answer Type Questions
Question 1:Write any two differences between twisted pair and co-axial pair cable.Answer:
Question 2:Write one advantage of Bus Topology of network, also, illustrate how 4 computers can be connected with each other using star topology of network.Answer:Bus topology:Â Cable length required for his topology is the least compared to other networks.
Question 3:Explain any two switching techniques used in networking.Answer:Message Switching:Â It is similar to Post-office mailing system. A temporary link is established for one message transfer.Packet Switching:Â It is a form of store and forward switching system which stores the message as small packets at the switch nodes and then transmits it to the destination.
Long Answer Type Questions
Question 1:Write answer of the following:(a) Differentiate between PAN and LAN types of networks.(b) Which protocol helps us to transfer files to and from a remote computer ?(c) Write two advantages of 3G over 2G mobile telecommunication technologies in terms of speed and services.(d) Write two characteristics of Web 2.0(e) Write the basic difference between worm and Trojan Horse.(f) Categorize the following under client-side and server-side scripts category:
Jave Script
ASP
VB Script
JSP
(g)Intelligent Hub India is a knowledge community aimed to uplift the standard of skills and knowledge in the society. It is planning to setup its training centres in multiple towns and villages pan India with its head offices in the nearest cities. They have created a model of their network with a city, a town and 3 villages as given.As a network consultant, you have to suggest the best network related solution for their issues/problems raisedin (i) to (iv) keeping in mind the distance between various locations and given parameters.
Shortest distance between various locations:
Number of computers iinstalled at various locations are as follows:
Note:⢠In Villages, there are community centres, in which one room has been given as training center to this organization to install computers.⢠The organization has got financial support from the government and top IT companies.
Suggest the most appropriate location of the SERVER in the YHUB (out of the 4 locations), to get the best and effective connectivity. Justify your answer.
Suggest the best wired medium and draw the cable layout (location to location) to efficiently connect variÂŹous locations within the YHUB.
Which hardware device will you suggest to connect all the computers within each location of YHUB?
Which server/protocol will be most helpful to conduct live interaction of Experts from Head office and people at YHUB locations?
Answer:1.(a)OR(b)Â FTP or Telnet or TCPFTP OR Telnet OR TCP(c)Â Speed
Faster web browsing.
Faster file transferService â
Better video clarity
Better security
OR(Any other correct advantage can be considered)
(d)Â Makes web more interactive through online social media.Supports easy online information exchange.Interoperability on the internet.Video sharing possible in the websites.(e)
(f)
(g)(i) YTOWNJustification
Since it has the maximum number of computers.
It is closet to all other locatios.
(ii) Optical Fiber
(iii) Switch or Hub(iv) Video conferencing or VoIP or any other correct service/protocol.
Question 2:Indian School, in Mumbai is starting up the network between its different wings. There are four Buildings named as SENIOR, JUNIOR, ADMIN and HOSTEL as shown below:The distance between various buildings is as follows:Number of Computers in Each Building :
Suggest the cable layout of connections between the buildings.
Suggest the most suitable place (i.e., building) to house the server of this school, provide a suitable reason.
Suggest the placement of the following devices with justification.
Repeater
Hub/Switch
The organisation also has inquiry office in another city about 50-60 km away in hilly region. Suggest the suitable transmission media to interconnect to school and inquiry office out of the following :
Fiber optic cable
Microwave
Radiowave
Answer:
 Server can be placed in the ADMIN building as it has the maxium number of computer.
Repeater can be placed between ADMINand SENIOR building as the distance is more than 110 m.
Radiowaves can be used in hilly regions as they can travel through obstacles.
Question 3:Vidya Senior Secondary Public School in Nainital is setting up the network between its different wings. There are 4 wings named as SENIOR(S), JUNIOR(J), ADMIN(A) and HOSTEL(H).Distance between various wings are given below:
Suggest a suitable Topology for networking the computers of all wings.
Name the most suitable wing where the Server should be installed. Justify your answer.
Suggest where all should Hub(s)/Switch(es) be placed in the network.
Which communication medium would you suggest to connect this school with its main branch in Delhi ?
Answer:
Server should be in Wing S as it has the maxi-mum number of computers. 1
All Wings need hub/switch as it has more thanone computer.
Since the distance is more, wireless transmission would be better. Radiowaves are reliable and can travel through obstacles.
Question 5:
Which out ot three type of networks LAN. MAN and WAN, is to be used when an institute connects computers of two adjacent computer laboratories ?
What is the difference between HTTP and FTP?
What is the major difference between Message Switching and Packet Switching in networking?
What is the basic difference between DNS and URL?
Give two applications of web 2.0.
Categories the following under client side and Server-Side script category?
JSP
ASP
VBScript
Jave Script
Answer:(i)Â LAN (The ange is upto one KM)(ii)Â (iv)(v)Â Application of web 2.0
web hosting
web browsing
web Indexing
web searching
(vi)Â Client side Script
JSP
Java ScriptServer Side Scripts
ASP
VB Script
Question 6:Trine Tech Corporation (TTC) is a professional consultancy company. The company is planning to set up their new offices in India with its hub at Hyderabad. As a network adviser, you have to understand their requirement and suggest them the best available solutions. Their queries are mentioned as (i) to (iv) below.Physical Locations of the blocked of TTC
What will be the most appropriate block, where TTC should plan to install their server?
Draw a block to cable layout to connect all the buildings in the most appropriate manner for efficient communication.
What will be the best possible connectivity out of the following, you will suggest to connect the new setup of offices in Bangalore with its London based office:
Satellite Link
Infrared
Ethernet Cable
Which of the following device will be suggested by you to connect each computer in each of the buildings:
Switch
Modem
Gateway
Answer:
Finance block because it has maximumnumber of computers.
Satellite link
Switch
Question 7:G.R.K International Inc. is planning to connect its Bengaluru Office Setup with its Head Office in Delhi. The Bengaluru Office G.R.K. international Inc. is spread across and area of approx. 1 square kilometer, consisting of 3 blocks â Human Resources, Academics and Administration.You as a network expert have to suggest answers to the four queries (i) to (iv) raised by them.Notes : Keep the distance between blocks and number of computers in each block in mind, while providing them the solutions.
Suggest the most suitable block in the Bengaluru Office Setup, to host the server.Give a suitable reason with your suggestion.
Suggest the cable layout among the various blocks within the Bengaluru Office Setup forconnecting the Blocks.
Suggest a suitable networking device to be installed in each of the blocks essentially required for connecting computers inside the blocks with fast and efficient connectivity.
Suggest the most suitable media to provide secure, fast and reliable data connectivity between Delhi Head Office and the Bengaluru Office Setup.
Answer:
Human Resources because it has maximum number of computers.
Switch 1
Satellite link
Question 8:Rovenza Communications International (RCI) is an online corporate training provider company for IT related courses. The company is setting up their new compus in Kolkata. You as a network expert have to study the physical locations of various blocks and the number of computers to be installed. In the planning phase, provide the best possible answers for the queries (i) to (iv) raised by them.Block to Block Distances(in Mtrs.)Expected computers to be installed in each block
Suggest the most appropriate block, where RCI should plan to install the server.
Suggest the most appropriate block to block cable layout to connect all three blocks for efficient communication.
Which type of network out of the following is formed by connecting the computers of these three blocks?
LAN
MAN
 WAN
Which wireless channel out of the following should be opted by RCI to connect to students from all over the world?
Infrared
Microwave
Satellite
Write two advantages of using open source software over proprietary software.
Which of the following crime(s) does not come under cybercrime?
Copying some important data from a computer without taking permission from the owner of-the data.
Stealing keyboard and mouse from a shop.
Getting into unknown personâs social networking account and start messaging on his behalf.
Answer:
Faculty Recording Block.
Star topology
LAN
Satellite connection
Advantages of open source over proprietary software:
Open source softwareâs source code is available, can be modified copied & distributed while propritary software canât be change.
Open source is free while proprietary a paid.
(c) Stealing keyboard & mouse from a shop.4
Question 9:
Identify the type of topology on the basis ofthe following:
Since every node is directly connected to the server, a large amount of cable is needed which increases the installation cost of the network.
It has a single common data path connecting all the nodes.
Answer:
Star Topology
Bus Topology
(ii) Expand the following
VOIP
SMTP
Answer:
Voice Over Internet Protocol
Simple Mail Transder Protocol
(iii) Who is a hacker?
Answer:A computer enthusiast, who uses his computer programming skill to intentionally access a computer without authorization is known as hacker. A hacker accesses the computer without the intention of destroying data or maliciously harming the computer.(iv) The following is a 32 bit binary number usually represented as 4 decimal values, each representing 8 bits, in the range 0 to 255 (known as octets) separated by decimal points. 140.179.220.200What is it? What is its importance?Answer:It is an IP Address. It is used to identify the computers on a network.(v) Daniel has to share the data among various computes of his two offices branches situated in the same city. Name the network (out of LAN, WAN, PAN and MAN) which is being formed in this process.Answer:MAN(vi)Rehaana Medicos Center has set up its new center in Dubai. It has four buildings as shown in the diagram given below:
As a network expert, provide the best possible answer for the following queries:
Suggest a cable layout of connections betÂween the buildings.
Suggest the most suitable place (i.e. building) to house the server of this organization.
Suggest the placement of the following device with justification:
Repeater (b) Hub/Switch
Suggest a system (hardware/software) to prevent unauthorized access to or from the network.
Answer:
Layout 1
The most suitable place / building to house the server of this organization would be building Research Lab, as this building contains the maximum number of computers.
Since the cabling distance between Accounts to Store is quite large, so a repeater would ideally be needed along their path to avoid loss of signals during the course of data flow in this route.
Firewall.
Question 10:
What is the difference between domain nameand IP address?
Write two advantages of using an optical fibre cable over an Ethernet cable to connect two service stations, which are 190 m away from each other.
Expertfa Professsional Global (EPG) is an online, corporate training provider company for IT related courses. The company is setting up their new campus in Mumbai. You as a network expert have to study the physical locations of various buildings and the number of computers to be installed. In the planning phase, provide the best possible answer for the
Building to Building distances (in Mtrs.)
Suggest the most appropriate building, where EPG should plan to install the server.
Suggest the most appropriate building to building cable layout to connect all three buildings for efficient communication.
Which type of network out of the following is formed by connecting the computers of these three buildings?
LAN
MAN
WAN
Which wireless channel out of the following should be opted by EPG to connect to students of all over the world?
Infrared
Microwave
Satellite
Answer:
Domain Name is alphanumeric addressof a resource over network IP address is a Numeric Address of a resource in a Network.Example:Domain Name 1www.Gabsclasses.comIP Address102.112.0.153
Optical fibre Advantages:
Faster Communication.
Free from electrical & Noise interference.
(a) Faculty Studio Building(b) Bus Topology(c) LAN(d) Satellite
Question 11:To provide telemedicine faculty in a hilly state, a computer network is to be setup to connect hospitals in 6 small villages (VI, V2, âŚ, V6) to the base hospital (H) in the state capital. This is shown in the following diagram.
No village is more than 20 km away from the state capital.Imagine yourself as a computer consultant for this project and answer the following questions with justification:
Out of the following what kind of link should be provided to setup this network: Microwave link, Radio Link, Wired Link ?
What kind of network will be formed; LAN, MAN, or WAN ?
Many times doctors at village hospital will have to consult senior doctors at the base hospital. For this purpose, how should they contact them: using email, sms, telephone, or video conference ?
(b) Out of SMTP and POP3 which protocol is used to receive emails ?(c) What are cookies in the context of computer networks?(d) Rajeshwari is trying for on-line subscription to a magazine. For this she has filled in a form on the magazineâs web site. When the clicks submit button she gets a message that she has left e-mail field empty and she must fill it. For such checking which type of script is generally executed client side script or server-side script ?(e) Mention any one difference between free-ware and free software.
Answer:(a)
Radio Link
MAN
e-mail
(b) POP3(c) Cookies are files that store user information that is used to identify the user when he logs into the system.(d) Server-side script(e) Freeware is a software that has the user to get unlimited usage for. Free software may be free for a certain period only.
Question 12:Workalot Consultants are setting up a secured network for their office campus at Gurgaon for their day-to-day office and web-based activities. They are planning to have connectivity between three buildings and the head office situated in Mumbai. Answer the questions (i) to (iv) after going through the building positions in the campus and other details, which are given below :
Suggest the most suitable place (i.e., building) to house the server of this organization. Also give a reason to justify your suggested location.
Suggest a cable layout of connections between the buildings inside the campus.
Suggest the placement of the following devices with justification:
Repeater.
Switch.
The organization is planning to provide a high speed link with its head office situated in Mumbai using a wired connection. Which of the following cables will be most suitable for this job ?
Optical Fiber
Co-axial Cable
Ethernet Cable
Answer:
The most suitable place to install server is building âREDâ because this building have maximum computer which reduce communication delay.
(a) Since the cabling distance between buildings GREEN, BLUE and RED are quite large, so a repeater each, would ideally be need along their path to avoid loss of signals during the course of data flow in there routes.
(b) In the layout a switch each, would be needed in all the buildings, to interconnect the group of cables from the different computers in each building.
(iv) Optical fiber
Question 13:Granuda Consultants are setting up a secured network for their office campus at Faridabad for their day to day office and web based activities. They are planning to have connectivity between 3 building and the head office situated in Kolkata. Answer the questions (i) to (iv) after going through the building positions in the campus and other details, which are given below:
Suggest the most suitable place (i.e., block) to house the server of this organization. Also give a reason to justify your suggested location.
Suggest a cable layout of connections between the buildings inside the campus.
Suggest the placement of the following devices with justification:
Repeater
Switch
The organization is planning to provide a high speed link with its head office situated in the KOLKATA using a wired connection. Which of the following cable will be most suitable for this job?
Optical Fibre
Co-axial Cable
Ethernet Cable
Answer:
The most suitable place to install server is building âJAMUNAâ because this building have maximum computer which reduce the communication delay.
Cable layout. (Bus topology).
(a) Since the cabling distance between buildings GANGA and JAMUNA are quite large, so a repeater each, would ideally be needed along their path to avoid loss of signals during the course of data flow in these routes.(b) In the layout a switch each would be needed in all the building, to intercoÂŹnnect the group of cables from the different computers in each building.
Optical fiber
Question 14:India Skills Hub is a skill development community which has an aim to promote the standard of skills in the society. It is planning to set up its training centres in multiple towns and villages Pan India with its head offices in the nearest cities. They have created a model of their network with a city ABC Nagar, a town (UVW town) and 3 villages.As a network consultant, you have to suggest the best network related solutions for their issues/ problems raised in (i) to (iv), keeping in mind the distances between various locations and other given parameters.
Note:â In Villagers, there are community centers, in which one room has been given as training entrer to this organization to install computers.â The organization has got financial support from the government and top Multinational OrganiÂzations.
Suggest the most appropriate location of the SERVER in the Cluster (out of the 4 locations), to get the best and effective connectivity. Justify your answer.
Suggest the best wired medium and draw the cable layout (location to location) to efficiently connect various locations within the Cluster.
Which hardware device will you suggest to connect all the computers within each location of
Which service/protocol will be most helpful to conduct live interactions of Expersts from Head Office and peole at all locations of Cluster?
Answer:
Best location for the server is UVW-TOWN, because it is approximately equidistant from the village P, Q and R.
For connectivity between UVW-TOWN to head office is optic Fiber and to connect the villages, P, Q and R with server at UVW- TOWN is co-axial cable.
The villages R Q and R can be connected with server at UVW-TOWN by a Hub and the head office is connected by a Bus topology.
Between head office and UVWTOWNwe recommend for Bus topology, so HTTP protocol and other terminal can be connected by UDP or FTP protocols.
Question 15:Mudra publishing is a group of companies engaged in publishing IT related books located in the hilly area of Shimla. The companies are located in four different, blocks whose layout is shown in the following figure. Answer the questions (i) to (iv) with the relevant justifi-cations.Mudra publishing
Distance between various Blocks :
Block A to Block C is 50 m
Block A to Block D is 100 m
Block B to Block C is 40 m
Block B to Block D is 70 m
Block C to Block D is 125 mNumber of Computers
Block A is 25
Block B is 50
Block C is 20
Block D is 120
 Suggest a suitable network topology between the blocks.
Which is the most suitable block to house the server of this organization?
Suggest the placement of the following devices with justification
Repeater
Switch
The organization is planning to link the whole blocks to its marketing Office in Delhi. Since cable connection is not possible from Shimla, suggest a way to connect it with high speed.
Answer:
Suitable topology is bus topology.
The most suitable block for hosting server is BLOCK-D because this block has maximum number of computers.Mudra Publishing
Switch is a device used to segment network into different sub-networks so switch will exist in all the blocks. Since distance between BLOCK-D and BLOCK-C is large so repeater will be install between BLOCK-D and BLOCK-C.
The most economic way to connect it with a reasonable high speed would be the use radiowave transmission, as they are easy to install, can travel long distance and penetrate buildings easily, so they are used for communication, both indoors and outdoors. Radiowaves also have the advantage of being omni-directional. They can travel in all the directions from the source, so that the transmitter and receiver do not have to be carefully aligned physically.
 TOPIC-2Network Security and Web ServiceVery Short Answer Type Questions(1 Mark each)
Question 1:Define firewall.Answer:A system designed to prevent unauthorized access to or from a private network is called firewall, it can be implemented in both hardware and software or combination of both.
Question 2:Write any two examples of Server side Scripts.Answer:
ASP
PHP
Question 3:What is the difference between E-mail & chat?Answer:
Chat occurs in near real time, while E-mail doesnât.
Chat is a 2-way communication which require the permission of both parties, while E-mail is a 1-way communication.
Question 4:Write names of any two popular open source software, which are used as operating systems.Answer:
Kernels
Unix
Linux
Question 5:What is the difference between video conferencing and chat.Answer:In conference, we can include more than one person and it allows text video and audio while chat is one-to-one communication.
Question 6:Expand the following abbreviations :
HTTP
VOIP
Answer:
HTTP-Hyper Text Transfer Protocol.
VOIP-Voice Over Internet Protocol.
Question 7:What is the difference between HTTP and FTP?Answer:Hyper Text Transfer Protocol deals with Transfer of Text and Multimedia content over internet while FTP (File Transfer Protocol) deals with transfer of files over the internet.
Question 8:What out of the following, will you use to have an audio-visual chat with an expert sitting in a far-away place to fix-up a technical issue ?
VoIP
email
FTP
Answer:(i) VoIP 1
Question 9:Name one server side scripting language and one client side scripting language.Answer:Client Side :
JAVASCRIPT
VBSCRIPTServer Side
ASP
JSP
Question 10:Which out of the following comes under cyber crime ?
Operating someoneâs internet banking account, without his knowledge.
Stealing a keyboard from someoneâs computer.
Working on someoneâs Computer with his/ her permission.
Answer:(i) Operating someoneâs internet banking account, without his knowledge.
Question 11:Name two proprietary software along with their application.Answer:
MS-Office â All office applications MS-Word, MS-Excel, MS-PowerPoint.
Visual Studio â Visual Basic, Visual C+ +software for application development.
Question 12:Out of the following, identify client side script (s) and server side script (s).
ASP
Javascript
VBScript
JSP
Answer:Server side scripting
ASP
JSPClient side scripting
Javascript
VBscript Vi
Question 13:Compare open source software and proprietary software.Answer:One need an authorized license paid in order to use this proprietary software while open sourcesoftware can be used by anybody and are usually free. One can use this software for their personal use. After giving any notation or code in this type one cannot change the code or modify it.
Question 14:Differentiate between XML and HTML.Answer:
Question 15:What is WEB 2.0 ?Answer:Web2.0 refers to the new generation of web based services and communities characterised by participation, collaboration and sharing of information among users online.
Question 16:Which of the following is/are not a client side script:
VB Script
Java Script
ASP
PHP ?
Answer:(iii) ASP and(iv) PHP are not client side scripts.
Question 17:If someone has hacked your website, to whom you lodge the complaint ?Answer:The complaint has to be lodged with the police under IT Act.
Question 18:What do you mean by IP address? How is it useful in computer security ?Answer:An Internet Protocol (IP) address is a numerical identification and logical address that is assigned to devices connected in a computer network.An IP address is used to uniquely identify devices on the internet and so one can quickly know the location of the system in the network. 1
Question 19:What do you mean by spam mails ? How can you protect your mailbox from spams ?Answer:Spam mails, also known as junk e-mail, is a subset of spam that involves nearly identical messages sent to numerous recipients by e-mail.We can protect our mailbox from spams by creating appropriate filters.
Question 20:When do you prefer XML over HTML and why ?Answer:The first benefit of XML is that because you are writing your own markup language, you are not restricted to a limited set of tags defined by proprietary vendors.Rather than waiting for standards bodies to adopt tag set enhancements (a process which can take quite some time), or for browser companies to adopt each otherâs standards with XML, you can create your own set of tags at your own place.
Question 21:How does firewall protect our network ?Answer:A firewall is a part of a computer system or network, that is designed to block unauthorized access while permitting authorized communi-cations. It is a device or set of devices configured to permit, deny, encrypt, decrypt, or proxy all (in and out) computer traffic between different security domains based upon a set of rules and, other criteria. 1
Question 22:Compare freeware and shareware.Answer:Freeware, the name derived from the words âfreeâ and âsoftwareâ. It is a computer software that is available for use at no cost or for an optional fee. Freeware is generally proprietary software available at zero price, and is not free software. The author usually restricts one or more rights to copy, distribute, and make derivative works of the software.Shareware is usually offered as a trial version with certain features only available after the license is purchased, or as a full version, but for a trial period. Once the trial period has passed, the program may stop running until a license is purchased. Shareware is often offered without support, updates, or help menus, which only become available with the purchase of a license. The words âfree trialâ or âtrial versionâ are indicative of shareware.
Question 23:How trojan horses are different from worms? Mention any one difference.Answer:A trojan horse is a term used to describe malware that appears to the user, to perform a desirable function but, in fact, facilitates unauthorized access, to the userâs computer system.A computer worm is a self-replicating computer program. It uses a network to send copies of itself to the other nodes (computers on the network) and it may do so without any user intervention.
Question 24:Give the full form of :
FOSS
HTTP
Answer:
FOSS :Â Free Open Source Software.
HTTP :Â Hyper Text Transfer Protocol.
Question 25:What is the difference between trojan horse and virus in terms of computers ?Answer:A trojan, sometimes referred to as a trojan horse, is non-self-replicating malware that appears to perform a desirable function for the user but instead facilitates unauthorized access to the userâs computer system. The term is derived from the trojan horse story in greek mythology.A computer virus is a computer program that can copy itself and infact a computer. A true virus can only spread from one computer to another.The chief difference between a trojan horse and a virus is that a trojan horse does not replicate itself. A virus does. 1
Question 26:Which term we use for a software/hardware device, which is used to block, unauthorized access while permitting authorized communiÂŹcations. This term is also used for a device or set of devices configured to permit, deny, encrypt, decrypt, or proxy all (in and out) computer traffic between different security domains based upon a set of rules and other criteria.Answer:Firewall.
Question 27:Write the full forms of the following:
GNU
XML
Answer:
GNU stands for âGNUâs Not Unixâ
XML stands for âExtensible Markup Languageâ.
Question 28:Expand the following terminologies:
GSM
WLL (IMP)
Answer:
GSM: Global System for Mobile Communication
WLL: Wireless Local Loop.
Question 29:Name some cyber offences under the IT Act.Answer:
Tampering with computer source documents
Hacking.
Publishing of information which is obscenein electronic form.
Question 30:What are the three ways of protecting intellectual property ?Answer:
Patents
Copyrights
Trademark
Question 31:When a user browses a website, the web server sends a text file to the web browser. What is the name of this?Answer:Cookies.
Short Answer Type Questions
Question 1:Define the following:
Firewall
VoIE
Answer:
Firewall:Â A system designed to preventunauthorized access to or from a private network is called firewall, it can be implemented in both hardware and software or combination of both.
VoIP:Â Voice-over-Internet Protocol(VoIP) is a methodology and group of technologies for the delivery of voice communications and multimedia sessions over Internet Protocol (IP) networks, such as the Internet.
Question 2:Give the full form of the following terms.
XML
FLOSS
HTTP
FTP
Answer:
XML:Â Extensible Markup Language.
FLOSS:Â Free-Libre Open Source Software.
HTTP:Â Hyper Text Transfer Protocol.
FTP:Â File Transfer Protocol.
Question 3:Differentiate between WORM and VIRUS in Computer terminology.Answer:VIRUS directly effects the system by corrupting the useful data. A computer virus attaches itself to a program or file enabling it to spread from one computer to another.A WORM is similar to a virus by design is considered to be subclass of a virus. Worm spread from computer to computer, but unlike a virus, it has the capability to travel without any human action. 2
Question 4:Expand the following
GSM
GPRS.
Answer:
GSM:Â Global System for Mobile Communi-cation.
GPRS:Â General Packet Radio Service.
Question 5:Expand the following abbreviations :
HTTP
VOIP
Answer:
HTTP:Â Hyper Text Transfer Protocol.
VOIP:Â Voice Over Internet Protocol.
Question 6:Give the full form of :
FOSS
HTTP
Answer:
FOSS:Â Free Open Source Software.
HTTP:Â Hyper Text Transfer Protocol.
Question 7:Write the full forms of the following :
GNU
XML
Answer:
GNU:Â GNUâs Not Unix
XML:Â Xtensible Markup Language.
Question 8:Expand the following terminologies :
GSM
WLL
Answer:
GSM:Â Global System for Mobile Communi-cation
WLL:Â Wireless Local Loop.
Question 9:Give the full forms of the following terms :
CDMA
TDMA
FDMA
Answer:
CDMA:Â Code Division Multiple Access
TDMA:Â Time Division Multiple Access
FDMA:Â Frequency Division Multiple Access
Question 10:Expand the following abbreviations :
FTP
TCP
SMTP
VOIP
Answer:
FTP:Â File Transfer Protocol
TCP:Â Transmission Control Protocol.
SMTP:Â Simple Mail Transfer Protocol.
VOIP:Â Voice Over Internet Protocol
via Blogger https://ift.tt/3bZDUs4
0 notes
Text
NCERT Class 12 Computer Science Chapter 6 Boolean Algebra
NCERT Class 12 Computer Science Python Solutions for Chapter 6 :: Boolean Algebra
TOPIC- 1
Basics of Boolean AlgebraVery Short Answer Type Questions (1 Mark each)
Question 1:Express the OR operator in terms of AND and NOT operator.Answer:
Question 2:Answer:(a) x+xâ=1-Complementary law(b) xy+x=x & absorption law
Question 3:Which gates are known as universal gates? Why?Answer:Universal gates are the ones which can be used for implementing any gate like AND, OR and NOT or any combination of these basic gates. NAND and NOR gates are universal gates.
Question 4:State and verify Associative law using Truth Table.Answer:Associative Law: This law states that:(A+B)+C=A+(B+C)(A.B).C=A.(B.C)Proof:From the above tables,(A+B)+C=A+(B+C)Similarly, we can prove,A.(B.C)=(A.B).C
Question 5:Draw the equivalent logic circuit for the following Boolean experession :Answer:
Short Answer Type Questions
Question 1:State and define principle of duality. Why is it so important in Boolean Algebra?Answer:Principle of duality:Â Duality principle states that from every boolean relation another boolean relation can be derived by:
Changing each OR sign (+) to an AND sign (â˘)
Changing each AND sign (.) to an OR sign (+)
ex : Dual of A + AâB = A . (A1Â + B)
Importance in Boolean Algebra:Â The principle of duality is an important concept in Boolean algebra, particularly in proving various theorems. The principle of duality is used extensively in proving Boolean algebra theorem. Once we prove that an expression is valid, by the principle of duality, its dual is also valid. Hence, our effort in proving various theorems is reduced to half.
Question 2:Write the equilent boolean expression for the following logic circuit.Answer:((Xâ.Yâ)â+(Xâ.Yâ)â)â
Question 3:Write the equilent boolean expression for the following logic circuit.Answer:
Question 4:Write the equivalent boolean expression for the following logic circuit:Answer:
Question 5:Name the law shown below & verify it using a truth table.Answer:This law is called âAbsorption Lawâ also reffered as redundance law.
Question 6:Obtain the Boolean Expression for the logic circuit shown below.Answer:
Question 7:Verify the following using truth table:(i) X+0=X(ii) X+xâ=1Answer:
Question 8:Obtain the Boolean Expression for the logic circuit shown below.
Answer:
Question 9:State Demorganâs law. Verify one of them using truth tableAnswer:
Question 10:Draw a logic circuit for the Boolean expressionAnswer:
Question 11:Obtain the boolean expression for the logic circuit shown below:Answer:
Question 12:Verify the following using Boolean Lawas:X+Z=X+XâZ+Y.ZAnswer:
Question 13:Verify the following using Boolean Lawas:A+C=A+Aâ.C+B.CAnswer:
Question 14:Obtain the Boolean Expression for the logic circuit shown below:Answer:
Question 15:Verify the following using truth table:(i) X.Xâ=0(ii) X+1=1Answer:
Question 16:Write the equivalent boolean expression for the following logic circuit:Answer:
Question 17:Answer:Distribution law: This law states that(i) x(y+z)=x.y+x.z(ii) x+yz=(x+y)(x+z)Noe let us prove using truth table.
Question 18:Name the law shown below & verify it using a truth table.A+B.C=(A+B).(A+C).Answer:This law is called âDistribute Lawâ.Prove ny Truth table
Question 19:Write the POS form of a Boolean Function F, which is represented in a truth table as follows:Answer:(P+Q+R).(Pâ+Q+R).(Pâ+Qâ+R)
Question 20:Write the Boolean Expression for the result of the Logic Circuit as shown below:Answer:The boolean expression is :I=[(A+b).(Aâ+Câ)].(B+C)
Question 21:Derive a Cannonical POS expression for a Boolean function G, represented by the following truth table:Answer:
Question 22:Correct the following boolen statements:Answer:
Question 23:Derive a Cannonical SOP expression for a Boolean function G, represented by the following truth table:Answer:
Question 24:Derive a Canonical POS expression for a Boolen funtion F, represented by the following truth table:Answer:
Question 25:Write the Boolen Expression for the result of the Logic Circuit shown below:Answer:C=P.Qâ+P.R+Q.Râ
Question 26:Verify the following using Boolen LawsPâ+Qâ.R=Pâ.Qâ.Râ+Pâ.Q.Râ+Pâ.Q.R+Pâ.Qâ.R+P.Qâ.RAnswer:
Question 27:Verify the following using Boolen Laws xâ+yâz = xâyâzâ+xâyâzâ+xâyz+xâyâz+xyâzAnswer:
Question 28:State and prove De-Morganâs laws in boolean algebra.DeMorganâs theorem states that:(i) (X+Y)â=Xâ.Yâ(ii) (X.Y)â=Xâ+YâAnswer:Now ,let us proove using truth table
Question 29:Write the equivalent boolean expression for the following logic circuit:Answer:
Question 30:Verify the following using truth table:Answer:
Question 31:Write the equivalent boolean expression for the following logic circuit:Answer:F=(X+Yâ).(X+Zâ)
Question 32:Verify the following using truth table:X+Y.Z=(X+Y).(X+Z)Answer:
Question 33:Write the equivalent boolean expression for the following logic circuit:Answer:PQâ+PRâ=P(Qâ+Râ)
Question 34:State abd cerify De-Morganâs laws algebraicallyAnswer:
Question 35:Write the equivalent boolean expression for the following logic circuit:Answer:F(P,Q)=(Pâ+Q).(P+Qâ)
Question 36:State and algebraically verify Absorption lawAnswer:
Question 37:Write the equivalent boolean expression for the following logic circuit:Answer:F(U,V)=(Uâ+V).(U+Vâ)
Question 38:Represent the expression Xâ.Y+Yâ.Z+ZâX using NAND gatesAnswer:
Question 39:Write the equivalent expression for the following logical circuit:Answer:F=Aâ.Bâ+BâCâ
Question 40:Verify the following algebraically.(Aâ+Bâ).(A+B)=Aâ.B+A.BâAnswer:
Question 41:Write the equivalent boolean expression for the following logic circuit:Answer:Y=(P+Qâ).(Q+Râ)
Question 42:Verify the following algebrically:Xâ.Y+X.Yâ=(Xâ+Yâ).(X=Y)Answer:
Question 43:Write the equivalent boolean expression for the following logic circuit:Answer:(Uâ+V).(Vâ+W)
Question 44:Answer:
TOPIC-2Karnaugh Map Minimization and Applications of Boolean AlgebraVery Short Answer Type Questions
Question 1:Convert the following Boolean expression into its equivalent Canonical Sum of Products form (SOP):(U + V + W)(U+V + Wâ)(Uâ+V + W) (Uâ + Vâ + Wâ )Answer:
Question 2:Write Product of Sum expression of the function F (a, b, c, d) from the given truth table.Answer:
Question 3:Write the Sum of Product form of the function F(P, Q, R) for the following truth table represenÂŹtation of F :Answer:
Question 4:Write the Product of Sum form of the function F(X, Y, Z) for the following truth table representation of F :Answer:
Question 5:Write the Product of Sum form of the function G(U, V, W) for the following truth table representation of G :Answer:
Question 6:Write the Product of Sum form of function G(U, V, W) for the following truth table representation of G :Answer:
Question 7:Write the Sum of Product form of the function F(A, B, C) for the following truth table reprsen- tation of F.Answer:
Question 8:Write the SOP form of a boolean function F, which is represented in a truth table as follows:Answer:F(X,Y,Z)=Xâ.YâZâ+Xâ.Yâ.Zâ+X.Yâ.Zâ+X.Y.Z
Question 9:Write the POS form of boolean function G, which is represented in a truth table as follows :Answer:G(A,B,C)=(A+B+C).(A+Bâ+Câ).(Aâ+B+C).(Aâ+B+Câ)
Question 10:Write the SOP form of a boolean function F, which is represented in a truth table as follows :Answer:SOP form is given byXâYâZâ + XâYâZ + XâYZ + XYâZâ + XYZ
Question 11:Write the POS form of a boolean function F, which is represented in a truth table as follows :
Answer:(A + B + C). (A+Bâ + Câ).(Aâ + B + Câ). (Aâ + Bâ + C)
Question 12:Write the SOP form of a boolean function F, which is represented in a truth table as follows :Answer:F=(0,3,6,7)So, SOP form of F isF = (Uâ.VâWâ) + (Uâ.VW) + (U.VWâ) + (U.VW)
Question 13:Write the POS form of a boolean function F, which is represented in a truth table as follows :Answer:F (U, V, W) = (U + V + Wâ).(U+Vâ+Wâ). (Uâ+V+Wâ)
Question 14:Write the SOP form of a Boolean function F, which is represented in a truth table as follows :
Answer:G (P, Q, R) = PâQRâ + PQâRâ + PQRâ + PQR
Question 15:Write the POS form of a boolean function H, which is represented in a truth table as follows :Answer:H (x, y, z) = (x + y + zâ). (xâ + y + zâ) . (xâ + yâ + z)
Question 16:Write the SOP form of a boolean function G, which is represented in a truth table as follows :
Answer:G (R Q, R) = PâQRâ + PâQR + PQâRâ + PQRâ + PQR
Question 17:Write the POS form of a boolean function G, which is represented in a truth table as follows :Answer:G(U. V W) = (U + V + W). (Uâ + V + Wâ). (Uâ + Vâ + W)
Question 18:Write the POS form of a boolean function F, which is represented in a truth table as follows :
Answer:F(U, V, W) = (U + V + Wâ) . (U + Vâ + Wâ) . (Uâ + V + Wâ)
Question 19:Reduse the following Boolean Expression to its simplest form using K-Map :Answer:
Question 20:Write the SOP form of a Boolean function G, which is represented in a truth table as follows :Answer:G(P, Q, R) = Pâ.Q.Râ + PQâ.Râ + EQ.Râ + EQ.R
Question 21:Write the POS equivalent of ABC + ABâCâ + ABCâ+ AâBâCAnswer:
Short Answer Type questions-II
Question 1:Obtain the minimal SOP form for the following Boolean expression using K-MapAnswer:
Question 2:Reduce the following Boolean expression using K-Map:F(A,B,C,D) = Ď(0,1,2,4,5,6,8,10)Answer:
Question 3:Reduce the following Boolean Expression using K-Map:Answer:
Question 4:Reduce the following Boolean Expression using K-Map:Answer:
Question 5:Reduce the following Boolean Expression using K-Map:Answer:
Question 6:Reduce the following Boolean Expression using K-Map:Answer:
Question 7:Reduce the following Boolean Expression using K-Map:Answer:
Question 8:Reduce the following Boolean Expression using K-Map:Answer:
Question 9:Reduce the following Boolean Expression using K-Map:Answer:
Question 10:Reduce the following Boolean Expression using K-Map:Answer:
Question 11:Reduce the following Boolean Expression using K-Map:F(A,B,C,D)=S(0,1,3,5,6,7,11,13,14,15)Answer:
Question 12:Reduce the following Boolean Expression using K-Map:Answer:
Question 13:Simplify the following boolean expression using K-Map:Answer:
Question 14:Reduce the following boolean expression using K-Map:Answer:
Question 15:Answer:
Question 16:Reduce the following Boolean Expression using K-Map:Answer:
Question 17:Reduce the follwing Boolean Expression using K-Map:Answer:
via Blogger https://ift.tt/32ubhjF
0 notes
Text
NCERT Class 12 Computer Science Chapter 4 Database Concepts
NCERT Class 12 Computer Science Python Solutions for Chapter 4 :: Database Concepts
Short Answer Type Questions-I
Question 1:Observe the following PARTICIPANTS and EVENTS table cerefully and write the name of the RDBMS operation which will be used to produce the output as shown in RESULT? Also, find the Degree and Cardinality of the RESULT.
Answer:Cartesian ProductDegree â 4Cardinality = 6
Question 2:Define degree and cardinality. Also, Based upon given table write degree and cardinality.Answer:Degree is the number of attributes or columns present in a table.Cardinality is the number of tuples or rows present in a table.Patients Degree = 4Cardinality = 5
Question 3:Observe the following table and answer the parts (i) and (ii):
In the above table, can we have Qty as primary key.
What is the cardinality and degree of the above table?
Answer:
We cannot use Qty as primary key because there is a duplication of values and primary key value cannot be duplicate.
Degree =4Cardinality = 5
Question 4:Explain the concept of union between two tables, with the help of appropriate example.Answer:The union operation denoted by âUâ combines two or more relations. The resultant of union operation contain tuples that are in either of the table or in both tables.
Question 5:Observe the following STUDENTS and EVENTS tables carefully and write the name of the RDBMS operation which will be used to produce the output as shown in LIST table? Also, find the degree and cardinality of the table.Answer:Cartesian ProductDegree = 4Cardinality = 6
Question 6:Observe the following MEMBER and ACTIVITY tables carefully and write the name of the RDBMS operation, which will be used to produce the output as shown in REPORT? Also, find the Degree and Cardinality of the REPORT.
Answer:Join operation or MEMBER U ACTIVITYDegree of Report = No of columns(No of Attributes) = 3Candinality Report = No of Rows(No of tuples) = 6
Question 7:Observe the table âClubâ given below:
What is the cardinality and degree of the given table?
If a new column Contact_No has been added and three more members have joined the club then
Answer:
Cardinality = 4 Degree = 5
Cardinality = 7
Degree = 6
Question 8:What do you understand by Union & Cartesian product in the relational algebra?Answer:Union of R ans S :The Union of two relations is a relation that includes all the tuples that are either in R or in S or in both R and S. Duplicate tuples are eliminated.The Union is an operator which works on two how sets. It combines the tuples of one relation with all the tuples of the other relation such that there is no duplication.
Cartesian Product:Â The cartesian product is an operator which works on two sets. It combines the tuples of one relation with all the tuples of the other relation.
Example:Â Cartesian Product
Question 9:Differentiate between the Alternate key of a table with the help of an example.Answer:Primary Key:Â A primary key is a value that can be used to identify a unique row in a table .Alternate Key:Â An alternate key is any candidate key which is not selected to be the primary keyExample:
So, (Bank Account Number, Aadhaar Number) are candidate keys for the table.Aadhaar Number â Primary keyBank Account Number â Alternate key
Question 10:Explain the concept of candidate key with the help of an appropriate example.Answer:Candidate key is a column or set of columns that can help in identifying records uniquely.Example, consider a Table STUDENT.Here, AdmnNo & Roll No define Table uniquely.Hence, they are candiadate keys
Question 11:What do you understand by degree & cardinality of a Table ?Answer:Degree refers to the number of columns in a table.Cardinality refers to the number of rows.
Question 12:Observe the following table and answer the part (i) and (ii) accordingly.Â
In the above table, can we take Mno as PriÂmary key ? (Answer as [Yes/No] only.)Â Justify your answer with a valid reason.
What is the degree and the cardinality of the above table?
Answer:
No
Degree = 4Cardinality = 5[Hint:Â Because Pencil and Eraser are having the same Mno = 2. Primary key needs to be unique]
Question 13:Give a suitable example of a table with sample data and illustrate Primary and Candidate keys in it.Answer:A table may have more than one such attribute or a group of attribute that identifies a row/ tuple uniquely, all such attribute(s) are known as Candidate keys. Out of the Candidate keys, one is selected as Primary key.Id = Primary key Id and Qty = Candidates Keys
Question 14:What do you understand by selection and projection operations in the relational algebra?Answer:Projection (n): In relational algebra, projection is a unary operation. The result of such projection is defined as the set obtained when the comÂponents of the tuple R are restricted to the set {a1âŚ,an} â it discards (or exculdes) the other attributes.Selection (): In relational algebra, a selection is a unary operation written as  (R) or (R) where:
a and b are attribute names
i is a binary operation in the set
v is a value constant
R is a relation
The selection (R) selects all those tuples in R for which i holds between the a atribute and the b attribute.
Example: Selection and Projection
Question 15:What do you understand by Primary key and Candidate keys.Answer:An attribute or set of attributes which are used to identify a tuple uniquely is known as primary key. If a tuple has more than one such attribute which identify a tuple uniquely, than all such attributes are known as candidate keys.
Question 16:What is relation? Define the relational data model.Answer:A relation is a table having atomic values, unique row, and unordered rows and columns. The relational model represent data and relationship among data by a collection of tables known as relation, each of which has a number of columns with unique names.
Question 17:Define domain with respect to database. Give an example.Answer:A domain is a pool of values from which the actual values appearing in a given column are drawn.For example: The values appearing in the Supp# column of both the suppliers table and the Shipment table are drawn from the same domain.
Question 18:Expand the following:
SQL
DBMS
Answer:
SQL â Structured Query Language.
DBMS â Data Base Management System.
Question 19:What do you understand by candidate keys in a table? Give a suitable example of candidate keys from a table containing some meaningful data.Answer:Candidate key:Â A candidate key is one that can identify each row of a table uniquely. Generally, a candidate key becomes the primary key of the table. If the table has more than one candidate key, one of them will become the primary key, and the rest are called alternate keys.Example:Question 20:What are all the domain names possible in genÂder ?Answer:Male and Female
Question 21:A table âcustomerâ has 10 columns but no row. Later, 10 new rows are inserted and 3 rows are deleted in the table. What is the degree and cardinality of the table customer.Answer:Degree = 10 [no. of cols]Cardinality = 10-3 = 7 [no. of rows]
Question 22:A table âstudentâ has 3 columns and 10 rows and another table âstudent 2â has the same columns as student but 15 rows. 5 rows are common in both the tables. If we take union, what is the degree and cardinality of the resultant table ?Answer:Degree = 3Cardinality = 30 (20 + 15 â 5)
Question 23:A table âstudentâ has 4 columns and 10 rows and âstudent 2â has 5 columns and 5 rows. If we take cartesian product of these two tables, what is the degree and cardinality of the resultant table ?Answer:Â Degree = 4 x 5 = 20 [no. of columns]Cardinality = 10 x 5 = 50 [no. of rows]
Question 24:In the following 2 tables, find the union value of Student 1 and Student 2.Answer:
via Blogger https://ift.tt/2RrnZJs
0 notes
Text
NCERT Class 12 Computer Science Chapter 5 Structured Query Language
NCERT Class 12 Computer Science Python Solutions for Chapter 5 :: Structured Query Language
Short Answer Type Questions
Question 1:Write queries for (i) to (iv) and find ouputs for SQL queries (v) to (viii), which are based on the tables.
Table : VEHICLEÂ
Note:
PERKS is Freight Charges per kilometer.
Km is kilometers Travelled
NOP is number of passangers travelled in vechicle.
To display CNO, CNAME, TRAVELDATE from the table TRAVEL in descending order of CNO.
To display the CNAME of all customers from the table TRAVEL who are travelling by vechicle with code Vo1Â or Vo2
To display the CNO and CNAME of those customers from the table TRAVEL who travelled between â2015-12Â31â and â2015-05-01â.
To display all the details from table TRAVEL for the customers, who have travel distacne more than 120 KM in ascending order of NOE
SELECT COUNT (*), VCODE FROM TRAVEL GROUP BY VCODE HAVING COUNT (*) > 1;
SELECT DISTINCT VCODE FROM TRAVEL :
SELECT A.VCODE, CNAME, VEHICLETYPE FROM TRAVEL A, VEHICLE B WHERE A. VCODE = B. VCODE and KM < 90;
SELECT CNAME, KM*PERKM FROM TRAVEL A, VEHICLE B WHERE A.VCODE = B.VCODE AND A. VCODE âV05â;
Answer:
Question 2:Consider the following tables SCHOOL and ADMIN and answer this question :Give the output the following SQL queries :
Select Designation Count (*) From Admin Group By Designation Having Count (*) <2;
SELECT max (EXPERIENCE) FROM SCHÂOOL;
SELECT TEACHER FROM SCHOOL WHERE EXPERIENCE >12 ORDER BY TEACHER;
SELECT COUNT (*), GENDER FROM ADÂMIN GROUP BY GENDER;
Answer:
Question 3:Write SQL qureries for (i) to (iv) and find outputs for SQL queries (v) to (viii), which are based on the tables TRANSPORT and TRIE
Note:
PERKS is Freight Charages per kilometer
TTYPE is Transport Vehicle Type
Note:
NO is Driver Number
KM is Kilometer travelled
NOP is number of travellers travelled in vehicle
TDATE is Trip Date
To display NO, NAME, TDATE from the table TRIP in descending order of NO.
To display the NAME of the drivers from the table TRIP who are traveling by transport vehicle with code 101 or 103.
To display the NO and NAME of those drivers from the table TRIP who travelled between â2015-02-10â and â2015-04-01â.
To display all the details from table TRIP in which the distance travelled is more than 100 KM in ascending order of NOP
SELECT COUNT (*), TCODE From TRIPGROUP BY TCODE HAVNING COUnT (*) > 1;
SELECT DISTINCT TCODE from TRIP;
SELECT A.TCODE, NAME, TTYPEFROM TRIP A, TRANSPORT BWHERE A. TCODE = B. TCODE AND KM < 90;
SELECT NAME, KM *PERKMFROM TRIP A, TRANSPORT BWHERE A. TCODE = B. TCODE AND A. TCODE = 105â˛;
Answer:
SELECT NO, NAME, TDATE FROM TRIP ORDER BY NO;
SELECT NAME FROM TRIPWHERE TCODE = 101 OR TCODE = 103;
SELECT NO AND NAME FROM TRIPWHERE â2015-02-10â < TDATE < â2015-04-01â;
SELECT NO, NAME, TDATE, KM, TCODE FROM TRIPWHERE KM >100 ORDER BY NOP;
TO DISPLAY THE MORE THAN ONE COUNT OF TCODE FROM THE TABLE TRIP
TO DISPALY SEPERATE TCODE OF TABLE TRIP
TO DISPAY THE NAME AND CODE OF THOSE TRANS PORTERS, WHO HAVE TRAVELLED MORE THAN 90 KMS.
TO DISPLAY THE NAME AND EXPENDITARE OF A TRANSPORTER WHO HAVE TCODE AS 105.
Question 4:Write SQL query to add a column total price with datatype numeric and size 10, 2 in a table product.Answer:ALTER TABLE PRODUCT ADD TOTAL PRICE NUMBER (10,2).
Question 5:Sonal needs to display name of teachers, who have â0â as the third character in their name. She wrote the following query.SELECT NAME FROM TEACHER WHERE NAME = â$$0?â;But the query isânt producing the result. Identify the problem.Answer:The wildcards are incorrect. The corrected query is SELECT NAME FROM TEACHER WHERE NAME LIKE â_ _0%â.
Question 6:Deepika wants to remove all rows from the table BANK. But he needs to maintain the structure of the table. Which command is used to implement the same?Answer:DELETE FROM BANK.
Question 7:While creating table âcustomerâ, Rahul forgot to add column âpriceâ. Which command is used to add new column in the table. Write the command to implement the same.Answer:ALTER TABLE CUSTOMER ADD PRICE NUMBER (10, 2).
Question 8:What is the use of wildcardAnswer:The wildcard operators are used with the LIKE operator to search a value similar to a specific pattern in a column. There are 2 wildcard operators.% â represents 0,1 or many characters â â represents a single number or character
Question 9:Differentiate between DELETE and DROP table commands ?Answer:DELETE command is used to remove inforÂŹmation from a particular row or rows. If used without condition, it will delete all row information but not the structure of the table. It is a DML command.DROP table command is used to remove the entire structure of the table and information. It is a DDL command
Long Answer Type Questions
Question 1:Write SQL commands for the queries (i) to (iv) and output for (v) & (viii) based on a table COMPANY and CUSTOMER.
To display those company name which are having prize less than 30000.
To display the name of the companies in reverse alphabetical order.
To increase the prize by 1000 for those customer whose name starts with âS?
To add one more column totalprice with decimal] 10,2) to the table customer
SELECTÂ Â Â COUNT(*)Â , CITYÂ Â Â FROM COMPANY GROUP BY CITY;
SELECT MIN(PRICE), MAX(PRICE) FROM CUSTOMER WHERE QTY>10;
SELECT AVG(QTY) FROM CUSTOMER WHERE NAME LIKE â%r%;
 SELECT PRODUCTNAME,CITY, PRICEFROM COMPANY, CUSTOMER WHERECOMPANY. CID=CUSTOMER.CID ANDPRODUCTNAME=âMOBILEâ;
Answer:
SELECT NAME FROM COMPANY WHERE COMPANY.CID=CUSTOMER. CID ANDPRICE < 30000;
SELECT NAME FROM COMPANY ORDER BY NAME DESC;
UPDATE CUSTOMERSET PRICE = PRICE + 1000WHERE NAME LIKE âS%â;
ALTER TABLE CUSTOMERADD TOTALPRICE DECIMAL(10,2);
50000,70000
11
Question 2:Consider the following tables SCHOOL and ADMIN and answer this question :
Write SQL statements for the following:
To display TEACHERNAME, PERIODS of all teachers whose periods are more than 25.
To display all the information from the table SCHOOL in descending order of experience.
To display DESIGNATION without dupliÂŹcate entries from the table ADMIN.
To display TEACHERNAME, CODE and corresponding DESIGNATION from tables SCHOOL and ADMIN of Male teachers.
Answer:
SELECT TEACHERNAME, PERIODSFROM SCHOOL WHERE PERIODS>25:
SELECT * FROM SCHOOL;
SELECT DISTINCT DESIGNATION FROM ADMIN;
SELECT TEACHERNAME.CODEDESIGNATION FROMSCHOOL.CODE = ADMIN.CODEWHERE GENDER = MALE;
Question 3:Write SQL commands for the queries (i) to (iv) and output for (v) to (viii) based on the tables Watchesâ and Sale given below.
TO DISPLAY ALL THE DETAILS OF THOSE WATCHES WHOSE NAME ENDS WITH âTIMEâ
TO DISPLAY WATCHâS NAME AND PRICE OF THOSE WATCHES WHICH HAVE PRICE RANGE IN BE-TWEEN 5000-15000.
TO DISPLAY TOTAL QUANTITY IN STORE OF UNISEX TYPE WATCHES.
TO DISPLAY WATCH NAME AND THEIR QUANTITY SOLD IN FIRST QUARTER;
SELECT MAX (PRICE), MIN(QTY_STORE) FROM WATCHES;
SELECT QUARTER, SUM(QTY SOLD) FROM SALE GROUP BY QUARTER;
 SELECT WATCH_NAME, PRICE, TYPE FROM WATCHES W, SALE S WHERE W. WATÂŁH1D!=S.WATCHID; (viii) SELECT WATCH_NAME, QTYSTORE, SUM (QTY_SOLD), QTY_STORESUM (QTYSOLD) âSTOCKâ FROM WATCHES W, SALE S WHERE W. WATCHID = S.WATCHID GROUP BY S.WATCHID;
Answer:
SELECT * FROM WATCHES WHERE WATCH_NAME LIKE â%TIMEâ(Vi mark for SELECT query) (Vi mark for where clause)
SELECT WATCH_NAME, PRICE WATCH WHERE PRICE BETWEEN 5000 AND 15000;(Vi mark for SELECT query) (Vz mark for where clause)
SELECT SUM (QTY STORE) FROM WATCHES WHERE TYPE LIKE âUNISEXâ;(Vz mark for SELECT query) (Vi mark for where clause)
SELECT WATCHNAME, QTY SOLD FROM WATCHES W,SALE S WHERE W. WATCHID = S. WATCHIDAND QUARTER = 1;
Question 4:Answer the questions (a) and (b) on the basis of the following tables SHOP and ACCESSORIES.
(a) Write the SQL queries:
To display Name and Price of all the Accessories in ascending order of their Price.
To display Id and SName of all Shop located in Nehru Place.
To display Minimum and Maximum Price of each Name of Accessories.
To display Name, Price of all Accessories and their respective SName where they are available.
(b) Write the output of the following SQL
SELECT DISTINCT NAME FROM ACCESSORIES WHERE PRICE> =5000;
SELECT AREA, COUNT(*) FROM SHOPPE GROUP BY AREA;
SELECT COUNT (DISTINCT AREA) FROM SHOPPE;
SELECT NAME, PRICE*0.05 DISCOUNT FROM ACCESSORIES WHERE SNO IN (âS02â,S03â);
Answer:(a)
SELECT Name, Price FROM ACCESSORIES ORDER BY Price Asc;
SELECT ID SName FROM SHOP WHERE Area=âNehru Placeâ;
SELECT Name, max (Price); min(Price) FROM ACCESSORIES, Group By Name;
SELECT Name,price, Sname FROMACCESSORIES, SHOP WHERE SHOEID=ACCESSORIES.ID;
(b)
Question 5:Write SQL queries for:
To display name, fee, gender, joinyear about the applicants, who have joined before 2010.
To display names of applicants, who are playing fee more than 30000.
To display names of all applicants in ascending order of their joinyear.
To display the year and the total number of applicants joined in each YEAR from the table APPLICANTS.
To display the C_ID (i.e., CourselD) and the number of applicants registered in the course from the APPLICANTS and table.
To display the applicantâs name with their respective courseâs name from the tables APPLICANTS and COURSES.
Give the output of following SQL statements:
SELECT Name, Joinyear FROM APPLIÂCANTSWHERE GENDER=âFâ and C_ID=âA02â˛;
SELECT MIN (Joinyear) FROMAPPLICANTSWHERE Gender=âmâ;
SELECT AVG (Fee) FROM APPLICANTSWHERE C_ID=âA0T OR C_ID=âA05â˛;
SELECT SUM- (Fee), C_ID FROM C_ IDGROUP BY C_IDHAVING COUNT(*)=2;
Answer:
SELECT NAME,FEE,GENDER,JOINYEARFROM APPLICANTSWHERE J OINYE AR <2010
SELECT NAME FROM APPLICANTS WHERE FEE >30000
SELECT NAME FROM APPLICANTS ORDERBY JOINYEAR ASC
SELECT YEAR,      COUNT]*)      FROMAPPLICANTS GROUP BY YEAR;
SELECT C_ID,        COUNT]*)      FROMAPPLICANTS, COURSES GROUP BY IDWHERE APPLICANTS.C_ID=COURSES. C_ID
SELECT NAME,COURSEÂ Â Â Â Â Â Â Â Â Â FROMAPPLICANTS, COURSESWHERE APPLICANTS. C_ID=COURSES. C_ID
Avisha 2009
2009Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
67Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
55000 A01Â Â Â Â Â Â Â Â Â Â Â Â
Question 6:Write SQL queries for (a) to (g) and write the output for the SQL queries mentioned shown in (hi) to (h4) parts on the basis of table ITEMS and TRADERS :
To display the details of all the items in ascending order of item names (i.e., INAME).
To display item name and price of all those items, whose price is in the range of 10000 and 22000 (both values inclusive).
To display the number of items, which are traded by each trader. The expected output of this query should be:
To display the price, item name and quantity (i.e., qty) of those items which have quantity more than 150.
To display the names of those traders, who are either from DELHI or from MUMBAI.
To display the names of the companies and the names of the items in descending order of company names.
Obtain the outputs of the following SQL queries based on the data given in tables ITEMS and TRADERS above.
SELECT MAX (PRICE), MIN (PRICE) FROM ITEMS;
SELECT PRICE*QTYFROM ITEMS WHERE CODE-1004;
SELECT DISTINCT TCODE FROM ITEMS;
 SELECT INAME, TNAME FROM ITEMS I, TRADERS T WHERE I.TCODE=T.TCODE AND QTY< 100;
Answer:
SELECT INAME FROM ITEMS ORDER BYINAME ASC;
SELECT INAME, PRICE FROM ITEMS WHERE PRICE => 10000 AND PRICE =< 22000; (c) SELECT TCODE, COUNT (CODE) FROM ITEMS GROUP BY TCODE;
SELECT PRICE, INAME, QTY FROM ITEMS WHERE (QTY> 150);
SELECT TNAME FROM TRADERS WHERE (CITY = âDELHIâ) OR (CITY = âMUMBAIâ)
SELECT COMPANY, INAME FROM ITEMSORDER BY COMPANY DESC;
(hi) 380001200(h2)1075000(h3)T01T02TO3(h4)Â LED SCREEN 40 DISP HOUSE INC CAR GPS SYSTEM ELECTRONICS SALES
Question 7:Write SQL queries for (a) to (f) and write the outputs for the SQL queries mentioned shown in (gl) to (g4) parts on the basis of tables PRODUCTS and SUPPLIERS
To display the details of all the products in ascending order of product names (i.e., PNAME).
To display product name and price of all those products, whose price is in the range of 10000 and 15000 (both values inclusive).
To display the number of products, which are supplied by each suplier. i.e., the expected output should be;
S01Â Â 2
S02Â Â 2
S03Â Â 1
To display the price, product name and quantity (i.e., qty) of those products which have quantity more thhn 100.
To display the names of those suppliers, who are either from DELHI or from CHENNAI.
To display the name of the companies and the name of the products in descending order of company names.
 Obtain the outputs of the following SQL queries based on the data given in tables PRODUCTS and SUPPLIERS above.
SELECT DISTINCT SUPCODE FROM PRODUCTS;
SELEC MAX (PRICE), MIN (PRICE) FROM PRODUCTS;
SELECT PRICE*QTYFROM PRODUCTS WHERE PID = 104; (g4)
SELECT PNAME, SNAMEFROM PRODUCTS P, SUPPLIERS S WHERE E SUPCODE = S. SUPCODEAND QTY>100;
Answer:
SELECT * FROM PRODUCTS ORDER BY PNAME ASC;
SELECT PNAME, PRICE FROM PRODUCTS WHERE ((PRICE => 10000) AND (PRICE = < 15000));
SELECT SUPCODE, COUNT (PID) FROM PRODUCTS GROUP BY SUPCODE;
SELECT PRICE, PNAME, QTY FROM PRODUCTS WHERE (QTY > 100);
SELECT SNAME FROM SUPPLIERS WHERE ((CITY = âDELHIâ) OR (CITY = âCHENNAIâ));
SELECT COMPANY, PNAME FROM PRO-DUCTS ORDER BY COMPANY DESC; 4
SOI1(gl)s02Â Â Â Â s03(g2) 280001100(g3) 550000(g4) PNAMEÂ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â SNAME ViDIGITAL CAMERA 14 XÂ Â Â Â Â Â Â Â GETALL INCPENDRIVE16 GBÂ Â Â Â Â Â Â Â Â Â Â Â Â Â GETALL INC
Question 8:Consider the following tables CARDEN and CUSTOMER and answer (b) and (c) parts of this question:
Give a suitable example of a table with sample data and illustrate Primary and Alternate Keys in it.
Write SQL commands for the following statements:
To display the names of all the silver coloured cars.
To display names of car, make and capacity of cars in descending order of their sitting capacity.
To display the highest charges at which a vehicle can be hired from CARDEN.
To display the customer name and the corresponding name of the cars hired by them.
Give the output of the following SQL queries:
SELECT COUNT(DISTINCT Make) FROM CARDEN;
SELECT MAX(Charges), MIN (Charges) FROM CARDEN;
SELECT COUNTS), Make FROM CARDEN;
Answer:
Primary Key of CARDEN = Ccode CARDENAlternate Key = CarName:Primary key of Customer = CodeAlternate Key of Customer = Cname 2
SELECT CarName From CARDENWHERE Color = âSILVERâ;
SELECT CarName, Make, Capacity FromCARDEN ORDER BY Capacity DESC;
SELECT MAX(Charges) Frm CARDEN;
ELECT Cname, CarName FromCARDEN, CUSTOMER WHERECARDEN. Ccode = CUSTOMER. Ccode;
(i) 4(ii) MAX(Charges)Â Â Â Â MIN (Charges)35Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 112(iii) 5(iv)Â SX4C Class
Question 9:Consider the following tables CABHUB and CUSTOMER and answer (b) and (c) parts of this question :
Give a suitable example of a table with sample data and illustrate Primary and Candidate Keys in it.
Write SQL commands for the following statements:
To display the names of all the white coloured vehicles.
To display name of vehicle name and capacity of vehicles in ascending order of their sitting capacity.
To display the highest charges at which a vehicle can be hired from CABHUB.
To display the customer name and the corresponding name of the vehicle hired by them.
Give the output of the following SQL queries :
SELECT COUNT(DISTINCT Make) FROM CABHUB;
SELECT MAX(Charges), MIN(Charges)
FROM CABHUB;
SELECT COUNT (*) Make FROM CABHUB;
SELECT Vehicle FROM CABHUB WHERE Capacity=4;
Answer:
Primary key of CABHUB = Vcode alternate key of CABHUB = Vehicle Name. Primary key of Customer = Ccode Alternate Key of CUSTOMER = Cname.
(i) SELECT VehicleName FROM CABHUBWHERE Colour = âWHITEâ;
SELECT VehicleName, capacity From CABHUB ORDER BY Capacity ASC;
SELECT MAX(Charges) FROM CABHUB;
SELECT Cname,VehicleName FROM CABHUB, CUSTOMER WHERE CUSTOÂMER. Vcode=CABHUB. Vcode;
(i) 4(ii) MAX(Charges)Â Â Â Â MIN (Charges)35Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 12(iii) 5(iv)Â SX4C Class
Question 10:Consider the following tables EMPLOYEE and DEPARTMENT and answer (a) and (b) parts of this question.
Write SQL commands for the following statements:
To display all DepName along with the DepCde in descending order of DepCde.
To display the average age of Employees in DepCde as 103.
To display the name of DepHead of the Employee named âSanjeev Pâ
To display the details of all employees who has joined before 2007 from EMPLÂOYEE table.
Give the output of the following SQL queries:
SELECT COUNT (DISTINCT DepCde) FROM EMPLOYEE;
SELECT MAX(JoinDate), MIN (JointDate) FROM EMPLOYEE;
SELECT TName, DepHead FROM EMPLOYEE E, DEPARTMENT DWHERE E.DepCde = D.DepCde;
SELECT COUNT (*) FROM EMPLOYEE WHERE Salary > 60000 AND Age > 30;
Answer:
(a)
SELECT DEPNAME, DEPARTME-NT.DepCde FROM EMPLOYEE, DEPARTÂMENT WHERE EMPLOYEE. DepCDE=DEPARTMENT. Â DepCde Order by DepCde DESC;
Select AVG (Age) from EMPLOYEE WHÂERE DepCde=â103âł;
SELECT DeptHead FROM DEPARTMENT WHERE Employee. TName=âSanjeev Pâ ANDÂ Â Â Â Â EMPLOYEE. DepCde= DEPARTMENT. DepCde;
SELECT * from EMPLOYEE WHEREjoinDate<â01-JAN-2007â˛;
Question 11:Consider the following tables WORKER and PAYLEVEL and answer (a) and (b) parts of this question:
(a) Write SQL commands for the following statements:
To display the name of all Workers in descending order of DOB.
To display NAME and DESIGN of those Workers, whose PLEVEL is either P001 or
To display the content of all the workers table, whose DOB is in between â19-JAN- 1984Ⲡand â18-JAN-1987â˛.
To add a new row with the following:19, âDayaKishoreâ, âOperatorâ, âP003â˛, â19- Sep-2008â, âll-Jul-1984â
(b) Give the output of the following SQL queries :
SELECT COUNT (PLEVEL), PLEVEL FROM WORKER GROUP BY PLEVEL;
SELECT MAX(DOB), MIN(DOJ) FROM WORKER;
SELECT Name,PAY FROM WORKERW,PAYLEVEL P WHERE W.LEVEL=P.PLEVEL AND W.ECODE<13;
SELECTÂ PLEVEL, PAYLEVELWHERE PLEVEL=âPOO3âł;
Answer:
(a)
SELECT NAME FROM WORKERORDER BY DOBDESC;
SELECT NAME, DESIGN FROM WORKER WHERE PLEVEL=âPOOO1âł ORPLEVEL=âPOO2âł;
SELECT * FROM WORKER WHEREDOB BETWEEN â19-JAN-1984 AND â18-JAN-1987â˛;
INSERT INTO WORKER VALUES (19,âDayaKISHOREâ, âoPERATORâ, âP0003â,â19-Sep-2008â˛,â11-Jul-1984â˛)â
(b)
Question 12:Consider the following tables EMPLOYEE and SALGRADE and answer (b) and (c) parts of this question:
(a) What do you understand by Selection and Projection operations in relational algebra ?(b) Write SQL commands for the following statements :
To display the details of all EMPLOYEES in descending order of DOJ.
To display NAME and DESIGN of those EMPLOYEES, whose SAL-GRADE is either S02 or S03.
TO display the content Of all the EMPLOYEES table, whose DOJ is in between â09-Feb-2006Ⲡand â08-Aug-2009â˛.
To add a new row with the following:109, âHarishRoyâ, âHEAD-ITâ, âSOX, â09-Sep-2007â˛, â21-Apr-1983â
(c) Give the output of the following SQLÂ queries :
SELECT COUNT(SGRADE), SGRADEFROM EMPLOYEE GROUP BYSGRADE;
SELECT MIN(DOB), MAX(DOJ) FROM EMPLOYEE;
SELECT NAME, SALARY FROMEMPLOYEE E, SAL-GRADE S WHEREE.SGRADE=  S.SGRADE AND E.ECODE<103â˛;
SELECTÂ SGRADE, SALARY +HRA FROM SALGRADE WHERE SGRADE =SGRADE=âS02;â
Answer:Projection(ff): In relational algebra, a projection is a unary operafion. The result of such projecion is defined as the set obtained when the components Of the tuple R are restriceted to the set {a1âŚâŚan}. It discards (or excludes) the other attributes.Selection(): In relational algebra, a selectionis a unary operation written as  (R) or  (R) where:
a and b are attribute names.
p is a binary operation in the set.
v is a value constant.
R is a relation.
The selection (R) selects all those tuples in R for which 9 holds between the a and the b
(b)
SELECT FROM EMPLOYEE ORDER BY DOJ DESC;
SELECT NAME, DESIGN FROM EMPLOYEE WHERE SGRADE â âS02â OR SGRADE = âSO3;
SELECT * FROM EMPLOYEE WHERE DOJ BETWEEN â09-FEB-2006ⲠAND â08- AUG -200%
INSERT INTO EMPLOYEE VALUES(109, âHARSH RAYâ, âHEAD-IT.S02â, â09-SEP-2007â˛, â21-APR-1983â˛);
Question 13:Consider the following tables GAMES and PLAYER and answer (b) and (c) parts of this question :
(a)What do you understand by primary key and candidate keys ?(b)Write SQL commands for the following stateÂments:
To display the name of all GAMES with their GCodes.
To display details of those GAMES which are having PrizeMoney more than 7000.
To display the content of the GAMES table in ascending order of Schedule Date.
To display sum of PrizeMoney for each type of GAMES.
(c) Give the output of the following SQL queries:
SELECT COUNT(DISTINCT Number) FROM GAMES;
SELECT MAX(ScheduleDate), MIN(Sche- duleDate) FROM GAMES
SELECT Name, GameName FROM GAMES G, PLAYER PWHERE (G.Gcode=PGcode AND G.Pri- zeMoney>10000);
SELECT DISTINCT Geode FROM PLAÂYER;
Answer:
(a)Â An attribute or set of attributes which are used to identify a tuple uniquely is known as a primary key. If a table has more than one such attributes which identify a tuple uniquely than all such attributes are known as candidate keys.
(b)
SELECT GameName, GCode FROM GAMES;
SELECT * FROM Games WHERE PrizeMoney >7000;
SELECT * FROM Games ORDER BY ScheduleDate;
SELECT SUM(Pnzemoney) FROM Games GROUPBY Type;
(c)
2
19-Mar-2004 12-Dec-2003
Ravi Sahai Lawn Tennis
101 108 103
Question 14:Consider the following tables ACTIVITY and COACH and answer (a) and (b) parts of this question :
(a) Write SQL commands for the following statements:
To display the names of all activities with their Acodes in descending order.
To display sum of PrizeMoney for the Activities played in each of the Stadium separately.
To display the coachâs name and acodes in ascending order of Acode from the table Coach.
To display the content of the Activity table whose schedule date earlier than 01-01-2004 in ascending order of Participants Num.
(b) Give the output of the following SQL queries:
SELECT COUNT (DISTINCT Participants Num) FROM ACTIVITY;
SELECT MAX (Schedule Date), Min (Schedule Date) FROM ACTIVITY;
SELECT Name, Activity Name FROM ACTIVITY A, COACH CWHERE A.Acode=C.Acode AND A.Parti- cipants Num=10;
SELECT DISTINCT Acode FROM COACH;
Answer:
(a)
SELECT Acodes, ActivityName FROM ACTIVITY ORDER BY ACode DESC;
SELECT SUM(PrizeMoney) FROM ACTIVITY GROUP BY Stadium;
SELECT Name, Acode FROM COACH ORDER BY Acode;
SELECT * FROM ACTIVITY WHERE SchduleDate < â01-Jan-2004ⲠORDER BY ParticipantsNum;
(b)
3
12-Dec-2003 19-Mar-2004
Ravinder Discuss Throw
100110081003
Question 15:Consider the following tables RESORT and OWNEDBY and answer (a) and (b) parts of this question:
(a)Write SQL commands for the following stateÂments:
To display the RCODE and PLACE of all â5 STARâ resorts in the alphabetical order of the place from table RESORT.
To display the maximum and minimum rent for each type of resort from table RESORT.
To display the details of all resorts which are started after 31-DEC-05 from table RESORT.
Display the OWNER of all â5 STARâ resorts from tables RESORT and OWNEDBY.
(b)Give output for the following SQL queries:
SELECT MIN(RENT) FROM RESORT Where PLACE = âKERALAâ;
SELECT TYPE, START DATEÂ FROM RESORT Where TYPE â2 STARâORDERBY STARTDATE,
SELECT PLACE, OWNERÂ FROMOWNEDBY Where PLACE LIKE â%Aâ;
SELECT RCODE, RENT FROM RESORT, OWNEDBY WHERE (RESORT PLACE= OWNEDBY. PLACE AND TYPE = â3 STARâ);
Answer:Â (a)
SELECT RCODE, PLACE FROM RESORT mere TYPE = â5 STARâ ORDERBY PLACE;
SELECr MAX (RENT), MIN (RENT) FROM RESORT GROUP BY TYPE;
SELECT FROM RESORT WHERE OSWAAL (BSE Question Bank. COMPUTER SCIENCE â PYTHON, STARTDATE > â31-DEC-05â˛;
SELECT OWNER FROM RESOR OWNEDBY B WHERE (A.TYPEÂ STARTâ AND A.PLACE B.PLACE);
(b)
Question 16:Consider the following tables STORE and SUPPLIERS and answer (a) and (b) parts of this question:
(a) Write SQL commands for the following stateÂments:
To display details of all the items in the STORE table in ascending order of LastBuy.
To display ItemNo and Item name of those items from STORE table whose Rate is more than 15 Rupees.
To display the details of those items whose supplier code (Scode) is 22 or Quantity in Store (Qty) is more than 110 from the table Store.
To display minimum Rate of items for each supplier individually as per Scode from the table STORE.
(b) Give the output of the following SQL queries:
SELECT COUNT(DISTINCT Scode) FROM STORE;
SELECT Rate* Qty FROM STORE WHERE ItemNo=2004;
SELECT Item, Sname FROM STORE S, Suppliers P
WHERE S.Scode=PScode AND ItemNo=2006;
SELECT MAX(LastBuy) FROM STORE;
Answer:
(a)
SELECT * FROM STORE ORDER BY LastBuy ASC;
SELECT ItemNo, Item FROM STORE WHERE Rate > 15;
SELECT * FROM STORE WHERE (Scode = â22â OR Qty >â110â˛);
SELECT Sname, MIN(Rate) FROM STORE, SUPPLIERS WHERE STORE. Scode = SUPPLIERS.Scode GROUP BY Sname;
(b)
3
880
Item                              SnameGel Pen Classic             Premium Stationers
24-Feb-10
Question 17:Consider the following tables STOCK and DEALERS and answer (a) and (b) parts of this question:
(a)Write SQL commands for the following statements:
To display the details of all Items in the STOCK table in ascending order of StockDate.
To display ItemNo and Item name of those items from STOCK table whose UnitPrice is more than Rupees 10.
To display the details of those items whose dealer code (Dcode) is 102 or quantity in STOCK (Qty) is more than 100 from the table Stock.
To display maximum UnitPrice of items for each dealer individually as per Dcode from the table STOCK.
(b)Give the output of the following SQL queries:
SELECT COUNT(DISTINCT Dcode)FROM STOCK;
SELECT Qty* UnitPrice FROM STOCK WHERE ItemNo=5006;
SELECT Item, Dname FROM STOCK S, Dealers D WHERE S.Dcode=D.Dcode AND ItemNo = 5004;
SELECT MIN (StockDate) FROM STOCK;
Answer:
(a)
SELECT*FROM STOCK ORDER BY StockDate;
SELECT Item No, Item FROM STOCK WHERE UnitPrice >10;
SELECT *FROM DEALERS, STOCKWHEREÂ Â Â Â (DEALERS.Dcode=â102âłOR STOCK.Qty >100 and DEALERS. DCODE = STOCK.DCODE);
SELECT MAX (Unitprice) FROM DEALERS, STOCK ORDER BY STOCK. Dcode WHERE DEALERS.Dcode = STOCK.Dcode;
(b)
3
4400
Item               DnameEraser Big        Clear Deals
01-Jan-09
via Blogger https://ift.tt/35CUZXv
0 notes
Text
NCERT Class 12 Computer Science Chapter 3 Lists Manipulation and Implementation
NCERT Class 12 Computer Science Python Solutions for Chapter 3 :: Lists Manipulation and Implementation
 TOPIC-1
Data StructuresShort Answer Type Questions (2 marks)
Question 1:Define a data structure.Answer:A data structure is a group of data which can be processed as a single unit. This group of data may be of similar or dissimilar data types. Data Structures are very useful while programming because they allow processing of the entire group of data as a single unit.
Question 2:Name the two types of data structures and give difference between them.Answer:Data structures are of two types: Linear and Non â Linear.
In a linear data structure, the elements are stored in a sequential order.
In a non linear data structure, no sequential order is followed.
Linear Data Structure Examples: Arrays: Non-Linear Data Structure Examples: Tree, graph lists, stacks, queues, linked lists.
Question 3:Give difference between an array and a list in Python.Answer:An array is defined as a set of contiguous data of similar data type. Python lists are actually arrays of variable length. The elements of a list are of eterogeneous types which means they are of different data types.
Question 4:How are lists implemented in memory?(or)How is memory allocated to a list in Python?Answer:A list in Python is an array that contains elements (pointers to objects) of a specific size only and this is a common feature of all dynamically typed languages. For implementation of a list, a contiguous array of references to other objects is used. Python keeps a pointer to this array and the arrayâs length is stored in a list head structure. This makes indexing of a list independent of the size of the list or the value of the index. When items are appended or inserted, the array of references is resized.
Question 5:What is sequential allocation of memory? Why do we say that lists are stored sequentially?Answer:A list is a allocated memory in sequential manner. This means that the elements of the list are stored in memory in sequence of their declaration. So, if you want to view the fifth element of the list, you have to first traverse through first four elements of the list. This is called sequential allocation of memory.
TOPIC-2Searching ListsShort Answer Type Questions-I (2 marks)
Question 1:How is linear search different from binary search?Answer:
Binary search requires the input data to be sorted near search doesnât.
Binary search requires an ordering comparison; linear search only requires equality comparisons
Binary search has complexity 0(log n); linear search has complexity O(n) as discussed earlier.
Binary search requires random access to the data; linear search only requires sequential access (this can be very important â it means a linear search can stream data of arbitrary size).
Short Answer Type Questions-II (2 marks)
Question 1:Accept a list containing integers randomly. Accept any number and display the position at which the number is found in the list.Answer:maxrange = input(âEnter Count of numbers: ââ)marks=[]flag=Falsefor i in range(0, maxrange):marks. append(input(â ?â))number = inputfEnter number to be searchedâ)for i in range(0, maxrange):if marks [i]==number:print number,âfound at positionâ,iflag=Trueif flag==False:print number, ânot found in listâ
Question 2:What will be the status of the following list after the First, Second and Third pass of the slection sort method used for arranging the following elements in descending order?Note :Â Show the status of all the elements after each pass very clearly underlining the changes.12,14, -54,64,90,24Answer:
Question 3:For a given list of values in descending order, write a method in Python to search for a value with the help of Binary search method. The method should return position of the value and should return -1 if the value not present in the list.Answer:def binarysrch (nums, x):high=len (nums)low=0while low < high:mid=(low+high)/2midval=nums [mid]if midval > x:low = mid + 1elif midval < x:high = midelse:return midreturn -1
TOPIC-3List SortingShort Answer Type Questions-I (2 marks)
Question 1:What is bubble sort?Answer:Bubble sort is a simple sorting algorithm that works by repeatedly stepping through the list to be sorted, comparing each pair of adjacent items and swapping them if they are in the wrong order. The pass through the list is repeated until no swaps are needed, which indicates that the list is sorted. The algorithm gets its name from the way smaller elements âbubbleâ to the top of the list. Because it only uses comparisons to operate on elements, it is also Called a comparison sort.
Question 2:Write an algorithm for selection sort.Answer:Selection sort performs the following steps:
Starting at index 0, search the entire array to find the next smallest or largest value.
Swap the smallest or largest value found with the value at index 0.
Repeat steps 1 & 2 starting from the next index.
Question 3:Explain insertion sort.Answer:Every repetition of insertion sort removes an element from the input data, inserting it into the correct position in the already-sorted list, until no input elements remain. The choice of which element to remove from the input is arbitrary and can be made using almost any choice algorithm.
Short Answer Type Questions-II (2 marks)
Question 1:Write a function that takes a list that is sorted in ascending order and a number as argument. The function should do the following:
Insert the number passed as argument in a sorted list.
Delete the number from the list.
Answer:from bisect import bisectdef listfunc(sortedlist,number) :insert_point = bisect (sortedlist, number)sortedlist.insert(insert_point,number)print âList after Insertionâprint sortedlistsortedlist.remove(number)print âList after Deletionâprint sortedlistmaxrange = inputfEnter Count of numbers: â)numlist=[]flag=Falsefor i in range(0, maxrange):numlist.append(input(â ?â))numlist.sort()number = inputfEnter the numberâ)listfunc(numlist,number)
Question 2:Consider the following list 95 79 19 43 52 3Write the passes of bubble sort sorting the list in ascending order till the 3rd iteration.Answer:[79,19, 43, 52, 3, 95]-Pass 1[19, 43,52,3,79, 95]-Pass 2[19,43,3, 52, 79, 95]-Pass 3
Question 3:Write a function that takes a sorted list and a number as an argument. Search for the number in the sorted list using binary search.Answer:def binary_search(SORTEDLIST, number):low=0high=len(SORTEDLIST)found=Falsewhile(low<high) and found==False:mid=(int) (low+high/2)if SORTEDLIST[mid]==number:print âNumber found atâ,midfound=Truebreakelif SORTEDLIST[mid]<number:low=mid+1else:high=mid-1if low >= high:print âNumber not foundâmaxrange = inputfEnter Count of numbers: â)numlist = []for i in range(0, maxrange):numlist.append(input(â?â))numlist.sort()print âSorted listâ,numlistnumber = inputfEnter the numberâ)binary_search(numlist,number)
Question 4:In the following list containing integers, sort the list using Insertion sort algorithm. Also show the status of the list after each iteration.15 -5 20 -10 10Answer:def insertion_sort(DATA_LIST):for K in range (1, len(DATA_LIST)):temp=DATA_LIST[K] # ptr=K-1,while(ptr>=0) and DATA_LIST[ptr]>temp:DATA_LIST[ptr+l]=DATA_LIST[ptr]ptr=ptr-1DATA_LIST [ptr+1] =tempprint DATA_LISTDATA_LIST = [15,-5,20,-10,10]print âLIST BEFOR SORTINGâ,DATAJ.ISTinsertion_sort(DATA_LIST)[-5,15, 20, -10,10][-5,15,20,-10,10]-Pass 1[-10,-5,15,20,10]-Pass 2[-10,-5,10,15, 20]-Pass 3
Question 5:What will be the status of the following after the First, Second and Third pass of the insertion sort method used for arranging the following elements in descending order ?Note:Â Show the status of all the elements after each pass very clearly underlining the changes.Answer:
Question 6:Consider the following unsorted list:99 78 25 48 51 11Sort the list using selection sort algorithm. Show the status of the list after every iteration.Answer:def selection_sort(DATA_LIST):for i in range(0, len (DATA_LIST)):min = ifor j in range(i + 1, len(DATA_LIST)):if DATA_LIST[j] < DATA_LIST[min]:min = j# swappingtemp= DATA_LIST[min]DATA_LIST[min] = DATA_LIST[i]DATA_LIST [i]=tempprint DATA_LISTDATA_LIST = [99 78 25 48 51 11]print âLIST BEFOR SORTINGâ,DATA_LISTselection_sort(DATA_LIST)
Question 7:Consider the following unsorted list Neena Meeta Geeta Reeta Seeta Sort the list using selection sort algorithm. Show the status of the list after every iteration.(or)Sort a list containing names of students in ascending order using selection sort.Answer:def selection_sort(DATA_LIST):for i in range(0, len (DATA_LIST)):min = ifor j in range(i + 1, len(DATA_LIST)):if DATA_LIST[j] < DATA_LIST[min]:min = j# swappingtemp= DATA_LIST[min]DATA_LIST[min] = DATA_LIST[i]DATA_LIST[i]=tempprint DATA_LISTNAME_LIST = [âNeenaâ,âBeetaâ,âReetaâ,âGeetaâ,âSeetaâ]print âLIST BEFORE SORTINGâ,NAME_LISTselection_sort(NAME_LIST)LIST BEFORE SORTING [âNeenaâ,âBeetaâ,âReetaâ, âGeetaâ, âSeetaâ][âBeetaâ, âNeenaâ, âReetaâ, âGeetaâ, âSeetaâ]-Pass 1[âBeetaâ, âGeetaâ, âReetaâ, âNeenaâ, âSeetaâ]-Pass 2[âBeetaâ, âGeetaâ, âNeenaâ, âReetaâ, âSeetaâ]-Pass 3[âBeetaâ, âGeetaâ, âNeenaâ, âReetaâ, âSeetaâ]-Pass 4[âBeetaâ, âGeetaâ, âNeenaâ, âReetaâ, âSeetaâ]-Pass 5
Question 8:A list contains rollno, name and marks of the student. Sort the list in descending order of marks using selection sort algorithm. [CBSE Text Book]Answer:def selection_sort(DATA_LIST):for i in range(0, len (DATA_LIST)):min = ifor j in range(i + 1, len(DATA_LIST)):if DATA_LIST[j][2] > DATA_LIST[min][2]:min = j# swappingDATA_LIST[min] [0] ,DATA_LIST[i] [0] = DATA_LIST[i] [0] ,DATA_LIST[mm] [0] DATA_LIST[min][l],DATA_LIST[i][l] = DATA_LI ST [i] [ 1 ],DATA_LI ST [min] [ 1 ] DATA_LIST[min] [2] ,DATA_LIST[i] [2] = DATA_LIST[i] [2],DATA_LIST[min] [2]print DATA_LISTmaxrange=input(âEnter Number of Students: â)Students=[]for i in range(maxrange):Details=[]Details. append(input(âEnter roll_noâ))Details.append(raw_input(âEnter nameâ))Details. append(inprft(âEnter marksâ))Students.append(Details)print Studentsselection_sort(Students)
Question 9:What will be the status of the following list after the First. Second and Third pass of the insertion sort method used for arranging the following elements in descending order ?12,34,46, -34,90,23Note :Â Show the status of all the elements after each pass very clearly underlining the changes.Answer:output of diferent passes Pass One[12,34,46,-34,90,23], {}Pass Two[34, 46, -34, 90, 23} , {12}Pass ThreeLISTS MANIPULATION AND IMPLEMENTATION[46, -34, 90, 23} , {12, 34} Pass SixPass Four {23}, {-34,12, 34, 46, 90}[-34, 90, 23} , { 12, 34, 46} Pass SevenPass Five {} , {-34,12, 23, 34, 46, 90}{90,23} , {-34,12,34,46} It is the sorted list.
Long Answer Type Questions (4 marks)
Question 1:Consider the following unsorted list: 90 78 20 46 54 1 Write the list after:
3rd iteration of selection sort
4th iteration of bubble sort
5th iteration of insertion sort Ans. Working :
Answer:Working :
3rd iteration of selection sort: [1,20,46,78,54,90]
4th iteration of bubble sort: [1, 20, 46, 54, 90, 78]
5th iteration of insertion sort: [1, 20, 46, 54, 78, 90
Question 2:Consider the following unsorted list:10 5 55 13 3 49 36Write the position of elements in the list after:(i) 5th iteration of bubble sort(Ăź) 7th iteration of insertion sort(iii) 4th iteration of selection sortAnswer:Working :
5th iteration of bubble sort: [3, 5,10,13, 36, 55, 49]
Insertion sort doesnât have the 7th iteration
4th iteration of selection sort: [3, 5,10,13, 55, 49, 36]
Question 3:Write a class CITY in Python with followingâ CName # String Value specifications :â Pop # Numeric value for Population instance attributes-KM # Numeric valueâ Ccode # Numeric valueâ Density #Numeric value for Population DensityMethods:â Dencal() #Method to calculate Density as Pop/KMâ Record() #Method to allow user to enter values Ccode, CName, Pop, KM and call DenCal ( ) methodâ View() #Method to display all the members also display a message âHighly Populated Cityâ if the Density is more than 10000.Answer:class CITY:def_init_(self): self.Ccode = 0self.CName = self. Pop = 0self.KM = 0 self.Density = 0def DenCal (self) :self.Density = self.Pop/self. KMdef Record (self)self Ccode=input (âEnter Ccodeâ)self.CName=raw_input (âEnter CNameâ)self.Pop=input (âEnter populationâ)self.KM=input (âEnter KMâ)DenCal(self) //or self.DenCal()def View (self):print Ccode, CName, Pop, KM, Densityif self.Density > 10000:print (âHighly populated cityâ)# OR print (âHighly populated cityâ)
Question 4:A list contains Item_code, Item_name, qty and price. Sort the list :
In ascending order of qty using Bubble sort.
In descending order of price using Insertion sort.
Answer:def bubble_sort(DATA_LIST) :i = 0j = 0l = len(DATA_LIST)for i in range(l):print âBubble Sort Iterations â Asc order of Quantityâfor j in range(i+l,l):if DATA_LlST[i][3] > DATA_LIST[j][3]:# swappingDATA_LIST[i][0], DATA_LIST[j] [0]=DATA LIST[j] [0],DATA_LIST[i] [0]DATA_LIST[i][1], DATA_LIST[j][1]=DATA_ LIST[j][l],DATA_LIST[i][l]DATA_LIST[i] [2], DATA_LIST[j] [2]=DATA_ LIST[j][2],DATA_LIST[i][2]DATA_LIST[i][3], DATA_LIST[j][3]=DATA_ LIST[j][3] ,DATA_LIST[i] [3]print DATA_LISTdef insertion_sort(DATA_LIST):for K in range (1, len(DATA_LIST)):temp=DATA_LIST[K][2]ptr=K-1print âInsertion Sort Iterations â Desc order of priceâwhile(ptr>=0) and DATA_LIST[ptr][2] < temp:DATA_LIST[ptr+1] [0]=DATA_LIST[ptr] [0]DATAJHST [ptr+1] [1]=DATA_LIST[ptr] [1]DATA_LIST[ptr+1][2]=DATA_LIST[ptr][2]DATA_LIST[ptr+1] [3]=DATA_LIST[ptr] [3]ptr=ptr-1DATA_LIST[ptr+1][2]=tempprint DATA_LISTmaxrange = input(âEnter Number of Items: â)Items=[]for i in range (maxrange):Details=[]Details. append(input(âEnter Item Codeâ))Details.append(raw_input(âEnter Item nameâ))Details.append(float(raw_input(âEnter priceâ)))Details.append(input(âEnter Quantityâ)) Items. append(Details)print âBEFORE SORTINGâ,Items bubble_sort(Items)insertion_sort(Items)
TOPIC-4Stacks And Queues With ListsVery Short Answer Type Questions (1 mark)
Question 1:Expand the following:
LIFO
FIFO
Answer:
LIFO: Last-In First-Out
FIFO: First-In First-Out
Question 2:Define stack.Answer:A stack is a data structure that allows adding and removing elements in a particular order. Every time an element is added, it goes on the top of the stack; the only element that can be removed is the element that was at the top of the stack.
Question 3:Define Queue.Answer:Queue is a first-in, first-out (FIFO) data structure, i.e. the element added first to the queue will be the one to be removed first. Elements are always added to the rear of the queue and removed from the front of the queue.
Question 4:Write all the operations possible in data structure.Answer:The major operations are:
Traversal
Insertion
Deletion
Searching
Question 5:What are the two major queue operations?Answer:Addition of element is known as INSERT operation, also known as enqueuing. It is done using rear terminal position, i.e. tail end. Removal of element is known as DELETE operation, also known as dequeueing.
Short Answer Type Questions-I (2 marks)
Question 1:Write an algorithm to implement push operation.Answer:
Start
Initialize top with -1.
Input the new element.
Increment top by one.
stack[top]=new element
Print âItem Insertedâ
Stop
Question 2:Write an algorithm to implement pop operation.Answer:
Start
If the value of top is -1 go to step 3 else go to step 4
Print âStack Emptyâ and go to step 7
Deleted item = Stack[top]
Decrement top by 1
print âItem Deletedâ
Stop
Question 3:Write an algorithm to implement insertion operaÂŹtion of queue.Answer:
Start
Check FRONT and REAR value,
if both the values are -1, then FRONT and REAR are incremented by 1
other wise Rear is incremented by one.
queue [Rear]=new element.
Stop
Question 4:Write an algorithm to implement deletion operation of queue.Answer:
Start
Check for underflow situation by checking value of Front=-1
If it is display appropriate message and stop
Otherwise Deleted item=queue [Front]
If Front=Rear then Front=Rear=-1 Otherwise Front is incremented by one
Print âItem Deletedâ
Stop
Question 5:For a given list of values in ascending order, write a method in Python to search for a value with the help of Binary Search method. The method should return position of the value and should return -1 if the value not present in the list.Answer:def Binary Search (list, search):lower_bound=0upper_bond=len(list) -1found=falsepos=âxâwhile lower_bound< =upper_bond:middle_pos=(lower_bound + upper_bond)/2if list [middle_pos] = = search:pos=middlepos found=True breakelif search < list [middle_pos]:upper_bound=middle_pos-l else:lower_bound=middle_pos + 1 if found:print(âThe item foundâ, pos) else:print (âThe item not availableâ)return (-1)
Long Answer Type Questions (4 marks)
Question 1:Write Insert (city) and Delete (City) methods in Python to add City and Romave City considering them to act as Insert and Delete operations of the data structure Queue.Answer:class queue:city=[ ]def Insert (self):a = raw_input(âEnter cityâ)queue.city append (a)def Delete (self):if (queue, city = = []):print âQueue emptyâelse:print âDeleted element isâ,queue.city[0]queue.city.delete ()ORclass queue:city=[ ]def Insert(self):a=raw_input(âEnter cityâ)queue.a.append(a)def Delete(self):if (queue.city==[ ]):print (âQueue emtpyâ)elseprint (âDeleted element isâ,queue, city [0])
Question 2:Define stack class in Python to operate on stack of numbers.Answer:Â class Stack:def_init_(self):self.s = [ ]def push(self):a = input(âEnter numberâ)self.s. append(a)def pop(self):self.s.pop()def display (self):l = len(self.s)for I in range(l-1,1,-1):print self.s[i]
Question 3:Write a function to push any studentâs information to stack.Answer:def push(stack):s=[]print âSTACK BEFORE PUSHâ display(stack)s.append(input(âEnter student rollno?â))s.append(raw_input(âEnter student nameâ))s.append(raw_input(âEnter student gradeâ))stack, append(s)def display (stack):l=len(stack)print âSTACK CONTENTSâfor i in range(l-1,-1,-1):print stack[i]stack=[]print âCreating Stackân = input(âEnter the number of studentsâ)for i in range(n): student = []student.append(input(âEnter student rollno?â))student.append(raw_input(âEnter student nameâ))student.append(raw_input(âEnter student gradeâ))stack, append(student) push(stack)display(stack)
Question 4:Write the push operation of stack containing names using class.Answer:class stack:s=[]def push(self):a=râaw_input(âEnter any name :â)stack.s.append(a)def display(self):l=len(stack.s) for i in range(l-1,-1,-1):print stack.s[i]a=stackOn= input(âEnter no. of namesâ)for i in range (n):a.push()a.display()
Question 5:Write Insert (Place) and Delete (Place) methods in Python to be add Place and Remove Place considering them to act as Insert and Delete operations of the data structure Queue.Answer:Class queue: place=[]def Insert (self):a=raw_input (âEnter cityâ)queue.place. append (a)def delete (self):if (queue.place = = []):print âQueue emptyâelse:print âDeleted element isâ, queue, place [0]class queue :place = [ ]def Insert (self) 1a = rawjnput (âEnter placeâ) queue, a.append (a)def delete (self):if (queue.place==[ ] ):print (âQueue emptyâ)else:print (âDeleted element isâ queue, place [0])queue.place.delete ( )
Question 6:Write the pop operation of stack containing names using class.Answer:class stack:s=[]def push (self):a=raw_input(âEnter any name :â)stack.s.append(a)def pop(self):if (a.s==D):print âStack Emptyâelse:print âDeleted element is : â,a.s.pop()def display (self):l=len(stack.s)print âSTACK CONTENTSâfor i in range(l-1,-1,-1):print stack.s[i]a=stack()n= input(âEnter no. of namesâ)for i in range(n):a.push()a.pop()a.display()
Question 7:Write the pop operation of stack containing num-bers using class.Answer:class stack:s=[]def push(self):a=input(âEnter number :â)stack.s.append(a)def pop(self):if (a.s==[]):print âStack Emptyâelse:print âDeleted element is : â,a.s.pop()def display(self):l=len(stack.s) print âSTACK CONTENTSâfor i in range(l-1,-1,-1):print stack.s[i]a=stack()n= input(âEnter count of numbersâ)for i in range (n):a.push()a.pop()a. display ()
Question 8:Write a function to add any customerâs information to queue.Answer:def insert(queue): customer=[]print âQUEUE BEFORE INSERTâ display(queue)customer.append(input(âEnter customer number?ââ))customer.append(raw_input(âEnter customer nameâ))customer.append(input(âEnter customer phone numberâ))queue. append(customer)def display (queue):l=len(queue)fori in range(O.l): print queue[i]queue=[]print âCreating Queueân=input(âEnter the number of customersâ)for i in range(n):customer=[]customer. append(input(âEnter customer number?â))customer.append(rawjnput(âEnter customer nameâ))customer.append(input(âEnter customer phone numberâ))queue.append(customer)insert(queue)display(queue)
Question 9:Write the insertion operation of queue containing character using class.Answer:class queue:s=0def insert(self):a=raw_input(âEnter any letter:â)queue.s.append(a)def display (self):l=len(queue.s)print âQUEUE CONTENTSâfor i in range(o,l):print queue. s[i]a=queue()n= input(âEnter no. of lettersâ)for i in range(n): a.insert()ch = raw_input(âDo you want to insert more lettersâ)if ch==âyâ:a.insert()a.display()
Question 10:Write Add(Fruit) and Remove (Fruit) methods in Python to insert name of a Fruit and to delete name of a Fruit considering them to act as Insert and Delete operations of the data structure Queue.Answer:def que insert (fruit, Rear) :ch=âyâwhile ch==âyâ or ch==âyesâFrt=input(âEnter a fruitâ)Rear=Rear + 1Fruit, append (Frt)print(âDo you wand to Add moreâ)ch=input ().upper ( )if ch==âNâ or ch==âNoâ :breakreturn reardef quedelete (Fruit, Rear):if not len (fruist):print f(âFruit + list is emptyâ)else :Rear = Rear â 1Frt = Fruit.pop( )print(âFruit is delete from listâ)return Rear
Question 11:Write the deletion operation of queue containing characters using class.Answer:class queue:s=0def insert(self):a=raw_input(âEnter any letter:â)queue.s.append(a)def delete(self):if (a.s==[]):print âQueue Emptyâelse:print âDeleted element is: â,queue.s[0]del queue.s[0]def display(self): l=len(queue.s)print âQUEUE CONTENTSâfor i in range(0,l):print queue.s[i]a=queue()n= input(âEnter no. of lettersâ)for i in range (n):a.insert()a. delete()a. display ()
Question 12:Write the deletion operation of queue containing numbers using class.Answer:class queue:s=[]def insert(self):a=input(âEnter the number:â)queue.s.append(a)def delete(self):if (a.s==Q):print âQueue Emptyâelse:print âDeleted element is: â,queue.s[0]del queue.s[0]def display(self):l=len(queue.s)print âQUEUE CONTENTSâfor i in range(0,l):print queue.s[i]a=queue()n= input(âEnter no. of numbersâ)for i in range(n):a.insert()a.delete()a.display()
TOPIC-5Applications of StacksVery Short Answer Type Questions (1 mark)
Question 1:Give one example of infix expression.Answer:A + B *C / D
Question 2:Give one example of postfix expression.Answer:ABC*D/+
Question 3:Give one example of prefix expression.Answer:+/*BCDA
Question 4:Convert (A+B)*C in to postfix form.Answer:AB+C*
Short Answer Type Questions-I (2 marks)
Question 1:Evaluate the following postfix notation of expressio,Show status of stack after every operation.12,2,7,34,20,-, +,5, +Answer:
Question 2:Evaluate the following postfix expression. Show the status of stack after execution of each operation separately: 2,13, + , 5, -,6,3,/,5,*,<Answer:Stack contentsResult: 0
Question 3:Evaluate using stack 10, 3,*, 30, 2,*,-Answer:
Question 4:Evaluate the following Postfix expression :20,10,-15,3,/, +, 5, *Answer:
Question 5:Convert A+ (B*C â (D / E A F) * G) * H into postfix form showing stack status after every step.Answer:
Question 6:Convert (True And False) OR (False And True) into postfix form using stack.Answer:
Question 7:What are the applications of queue in computer?Answer:In a single processor multitasking computer, job(s) wait to be processed form a queue. Same happens when we share a printer with many computers.
Compiling a HLL code.
Using download manager, for multiple files also uses queue for ordering the files.
In multiuser OS â job scheduling is done through queue.
Question 8:Evaluate the following postfix notation of expression. Show status of stack after every operation.Answer:Final Result = 1
Question 9:Evaluatethefollowingpostixnotationofexpression. Show status of stack after every operation.12,2, *, 24,20, -, +, 8, âAnswer:
Question 10:Give few applications of stack.Answer:
Expression evaluation
Backtracking (game playing, finding paths, exhaustive searching).
Memory management, run-time environment for nested language features.
Short Answer Type Questions-II (2 marks)
Question 1:Write an algorithm to evaluate postfix expression.Answer:Step 1: StartStep 2:Â Check all symbols from left to right and repeat steps 3 & 4 for each symbol of expression âEâ until all symbols are over.
If the symbol is an operand, push it onto stack.
If the symbol is an operator then:
Pop the top two operands from stack and apply an operator in between them.
Evaluate the expression and place the result back on the stack.
Step 3:Â Set result equal to top element on the stack.Step 4:Â Stop
Question 2:Write an algorithm to convert infix to postfix.Answer:
Create an empty stack and an empty postfix output string/stream.
Scan the infix input string/stream left to right.
If the current input token is an operand, simply append it to the output string (note the examples above that the operands remain in the same order).
If the current input token is an operator, pop off all operators that have equal or higher precedence and append them to the output string; push the operator onto the stack. The order of popping is the order in the output.
If the current input token is push it onto the stack.
If the current input token is â)â, pop off all operators and append them to the output string until a â(â is popped; discard the â(â.
If the end of the input string is found, pop all operators and append them to the output string.
via Blogger https://ift.tt/3bYPaoy
0 notes
Text
NCERT Class 12 Computer Science Chapter 2 Object Oriented Programming Concepts
NCERT Class 12 Computer Science Python Solutions for Chapter 2 :: Object Oriented Programming Concepts
 TOPIC-1
General OOP ConceptsShort Answer Type Questions (2 marks)
Question 1:How is a static method different from an instance method?Answer:Static method has to be defined outside a class. It can be called without an object.Instance method is defined within a class and has to be invoked on an object.
Question 2:Explain Data Hiding with respect to OOP.Answer:Data hiding can be defined as the mechanism of hiding the data of a class from the outside world or to be precise, from other classes. Data hiding is achieved by making the members of the class private. Access to private members is restricted and is only available to the member functions of the same class. However the public part of the object is accessible outside the class.
Question 3:Fill in the blanks:
Act of representing essential features without background detail is called ______ .
Wrapping up of data and associated functions into a single unit is called ______ .
______ is called the instance of a class.
Answer:
Data Abstraction
Encapsulation
Object
Question 4:What is Object Oriented Programming? List some of its advantages.Answer:OOP allows decomposition of a problem into a number of entities called objects and then builds data and functions around these objects. Advantages:
Simplicity
Modifiability
Extensibility and Maintainability
Reusability
Security
Question 5:Differentiate between an object and a class.Answer:A class is a collection of objects of similar type.For example, mango, apple and orange are members of the class fruit. Classes are user-defined data types and behave like the built-in types of a programming language.The syntax used to create an object is not different than the syntax used to create an integer object in C. If fruit has been defined as a class, then the statement fruit mango; will create an object mango belonging to the class fruit.
Question 6:Explain polymorphism with an example.Answer:Polymorphism is the ability for a message or data to be processed in more than one form. An operation may exhibit different behaviors in different instances. For example, consider the operation of addition of two numbers, the operation will generate a sum. If the operands are strings, then the operation would produce a third string by concatenation.
Question 7:List three features that make an important charac-teristic of OOP.Answer:
Capability to express closeness with the real- world models.
Reusability-allows addition of new features to an existing one.
Transitivity-changes in one class get automatically reflected across.
Question 8:How do we implement abstract method in python? Give an example for the same.Answer:Abstract method : An unimplement method is called an abstract method. When an abstract medhod is declared in a base class the derived class has to define the method or raise âNotimplemented Errorâ
Or
Abstract Method can be used to enable parent class method execution.Class Shape (object):def findArea (self): passClass Square (Shape):def init (self, side):self, side = side def findArea self.side*self.side
Question 9:List few disadvantages of OOP.Answer:
Classes tend to be overly generalized.
Relationship among classes might become artificial.
Program design is tricky and complicated.
More skills and thinking in terms of objects is required.
Question 10:Explain Function overloading with an example.Answer:When several function declarations are specified for a single function name in the same scope, the function is said to be overloaded. In other languages, the same function name can be used to define multiple functions with different number and type of arguments, def test(): #function 1 print âhelloâdef test(a, b): #function 2return a+bdef test(a, b, c): #function 3return a+b+c 2
Question 11:What is inheritance? Explain with an example.Answer:Inheritance is the capability of one class to acquire the properties or capabilities of another class. For example, the bird âParrotâ is a part of the class âFlying Birdâ which is again a part of the class âBirdâ.
Question 12:How data encapsulation and data abstraction are implemented in Python, explain with an example.
Or
How do abstraction and encapsulation complement each other?Answer:Abstraction and Encapsulation are complementary concepts. Through encapsulation only we are able to enclose the components of the object into a single unit and separate the private and public members. It is through abstraction that only the essential behaviors of the objects are made visible to the outside world.So, we can say that encapsulation is the way to implement data abstraction. For example in class Student, only the essential information like roll no, name, date_of_birth, course, etc. of the student will be visible. The secret information like calculation of grades, allotment of examiners etc. will be hidden.
Question 13:Consider the figure given below and answer the questions that follows:
Name the base class and the derived class.
Which concept of OOP is implemented in the figure given above?
Answer:
Base class â STUDENTDerived classes â GRADUATE & POST GRADUATE
Inheritance
Question 14:What is abstract method? Give a suitable example to illustrate the same.Answer:Abstract Method: An abstract method is a method defined in the base class, but does not require code for the implementaion. e.g.,Class teacher: def entry (self):teach#=int(input(âEnter Noâ))def display ( ):print (self, teach #)
Question 15:What is the concept of overriding method? Give an example for the same.Answer:Overriding Methods : It is a method to access, the paramterized constructer with same name but having different parameters. For example,Class emp:def_init_(self, n):self, a = n def_init_(self):self, a = 100
Question 16:Is function overloading supported by Python? Give reasons.Answer:A given name can only be associated with one function at a time, so cannot overload a function with multiple definitions. If you define two or more functions with the same name, the last one defined is used.However, it is possible to overload a function, or otherwise genericized it. You simply need to create a dispatcher function that then dispatches to your set of corresponding functions. Another way to genericized a function is to make use of the simple generic module which lets you define simple single-dispatch generic functions.def test(): #function 1print âhelloâdef test(a, b): #function 2return a+bdef test(a, b, c): #function 3return a+b+cIf you run the code of three test functions, the second test() definition will overwrite the first one. Subsequently the third test() definition will overwrite the second one. That means if you give the function call test (20,20), it will flash an error stating, âType Error: add() takes exactly 3 arguments (2 given)â. This is because, Python understands the latest definition of the function test() which takes three arguments.
Question 17:Predict the output of the following program. Also state which concept of OOP is being implemented?def sum(x,y,z):print âsum= â, x+y+zdef sum(a,b):print âsum= â, a+bsum(10,20)sum(10,20,30)Answer:Type Error: sum() takes exactly 3 arguments (2 given)Concept: Polymorphism [Function Overloading]
Question 18:Define binding. Differentiate between static and dynamic binding.Answer:Binding is the process of linking the function call to the function definition. The body of the function is executed when the function call is made. Binding can be of two types:Static Binding: In this type of binding, the linking of function call to the function definition is done during compilation of the program.Dynamic Binding: In this type of binding, linking of a function call to the function definition is done at run time. That means the code of the function that is to be linked with function call is unknown until it is executed.
Long Answer Type Questions (4 marks)
Question 1:Write a program that uses an area() function for the calculation of area of a triangle or a rectangle or a square. Number of sides (3, 2 or 1) suggest the shape for which the area is to be calculated.Answer:from functools import wrapsimport mathdef overloaded(func):@wraps(func)def overloaded_func(*args, **kwargs):for f in overloaded_func.overloads:try:return f(*args, **kwargs)except TĂżpeError:passelse:# it will be nice if the error message prints a list of# possible signatures hereraise TĂżpeError(âNo compatible signaturesâ)def overload_with(func):overloaded_func.overloads.append(func)return overloaded_funcoverloadedjunc.overloads = [func]overloaded_func.overload_with = overload_withreturn overloaded_func
#############Šoverloadeddef area():print âAreaâ[email protected]_withdef _(a):# note that, like property(), the functionâs name in# the âdef _(n):â line can be arbitrary, the important# name is in the â@overloads(a)â lineprint âArea of square=â,a*apass
@area.overload_withdef _(a,b):# note that, like property(), the functionâs name in# the âdef _(nl,n2):â line can be arbitrary, the important t# name is in the â@overloads(a)â lineprint Area of rectangle=â,a*[email protected]_withdef _(a.b,c):s= (a+b+c)/2print sprint Area of triangle=â, math.sqrt(s*(s-a)* (s-b)*(s-c))passchoice=input(âEnter 1-square 2-rectangle 3- tr-iangleâ)if choice==1:side = input(âEnter sideâ) area(side)elif choice ==2:length = input(âEnter lengthâ)breadth = input(âEnter breadthâ)area(length,breadth) elif choice==3:a = inputfEnter sidelâ)b = inputfEnter side2â)c = inputfEnter side3â) area(a,b,c)else:print âInvalid choiceâ
Question 2:Write a program to find out volume of a cube, cuboid and cylinder using function overloading.Answer:from functools import wraps import math def overloaded(func):@wraps(func)def overloaded_funcfargs, **kwargs):for f in overloaded_func.overloads:try:return ff args, **kwargs)except TypeError:pass 1else:# it will be nice if the error message prints a list of# possible signatures here raiseTypeError(âNo compatible signaturesâ)def overload_with(func):overloaded_func.overloads.append(func)return overloaded_funcoverloaded_func.overloads = [func]overloaded_func.overload_with = overload_withreturn overloaded_func #############@overloadeddef volume():print âVolumeâ[email protected]_with def _(a):print âVolume of cube=â,a*a*a, âcubic unitsâ[email protected]_with def _(a,b):print âVolume of cylinder, 3.14*a*a*b,âcubic unitsâ[email protected]_with def _(a,b,c):print âVolume of cuboid=â, a*b*c, âcubic unitsâpasschoice = input(âEnter 1-cube 2-cylinder 3-cuboidâ)if choice==1:side = input(âEnter sideâ)volume (side)elif choice ==2:radius = input(âEnter radiusâ)height = input( âEnter heightâ)volume(radius,height)elif choice==3:length = input(âEnter lengthâ)breadth = input(âEnter breadthâ)height = input(âEnter heightâ)volume (length, breadth, height)else:print âInvalid choiceâ
Question 3:Write a class CITY in Python with following specification :
Code # Numberic value
Name # String value
Pop # Numberic value for Population
KMÂ # Numberic value
Density # Numberic value for Population DensityMethods:
CalDen ( ) # Method to calculate Density as Pop /KM
Record ( ) # Method to allow user to enter values Code, Name, Pop, KM and call CalDen ( ) method
See ( ) # Method to display all the date members also display a message âHighly Populated Areaâ is the Density is more than 12000.
Answer:class CITY:def _init_ (self):self. Code = 0self. Name =â âself. Pop = 0self. KM = 0self. Density = 0def CalDen (self):self. Density = self. Pop/self. KMdef Record (self)self: Code = input (âEnter Codeâ)self.Name=raw_input(âEnter Nameâ)self. Pop = input (âEnter populationâ)self. KM = input (âEnter KMâ)CalDen (self) // or self.CalDen ( )def See (self):print Code, name, Pop, KM, Densityif self. Density > 12000:print (âHighly Populated Areaâ)# OR print (âHighly populated Areaâ)Note :Â Accept self. _Cose to indicate private members
Question 4:Give a suitable example using Python code to illustrate single level inheritance considering COUNTRY to be BASE class and STATE to be derived class.Answer:Class COUNTRY: statejist = [ ]def_init_(self, name):self.name = name class state (COUNTRY):def_init_(self, name, capital): super ( )._init_(name)self.capital = capital
Question 5:Write a class DISTRICT in Python with following specification:Instance Attributesâ Dcode # Numeric valueâ DName # String valueâ People # Numeric value for Populationâ Area # Numeric valueâ Density # Numeric value for Population DensityAnswer:Class DISTRICT ( ) :def_init_(self, Dcode, DName, People, Area, Density):self.Dcode = Dcodeself.DName = DNameself.People = Peopleself. Area = Areaself.Density = DensityDef display (self):print (âDistrict Codeâ, self.Dcode)printf (âDistrict Nameâ, self.Dname)printf (âPopulationâ, self.people)printf (âAreaâ, self.Area)printf (âDensityâ, self.Denstity)
Question 6:Answer the question (i) to (iv) based on the following:Class Shop (object):Class shop_(self) :self . no_of _employees = 0self. no_of _brands= 0def getSdate (self) :self. no_of_employees=input(âNumber of employeesâ)self.no_of_brands=input(âNumber of brandsâ)def showSdate (self) :Print self.no of employeesPrint self.no of brands class Brand (object) :def init_(self) :self.name = â âself.category=(âMensâ, âWomensâ, âKidsâ)self.avgprice=0, 0def getdate (self) :self.name = raw_input(âEnter Brand Nameâ)self.avgprice = input(âEnter Average Priceâ)def showdate (self) :Print self, namePrint self, categoryPrint self, avgpriceClass Mall (Brand, Shop) :def showdate (self) :self.no of shops = 0def getdate (self) :super (mall, self).getSdate ( ) # Statementsuper (mall, self).getdate ( ) # Statement 2self.no_of_shops=input (âEnter number of shopsâ)def showdata(self)print self.no_of_shopsprint self.no of brands # Blank 1
Which type of inheritance is demonstrated in the above code?
Explain Statement 1 and 2.
Name the methods that are overridden along with their class name.
Fill Blank 1 with a statement to display variable category of class Brand.
Answer:
Multiple Inheritance
Statement 1 and 2 invoke the getSdate() function of class shop and getData() function of class Brand respectively.
getdata() method of class Brand is overridden. When object of class Mall is created.M=Mall ( )k.getdata ( )getdate( ) methodof class Mall is invoked and not of class Brand is called.
print Brand ( ). category
TOPIC-2ClassesShort Answer Type Questions (2 marks)
Question 1:Give one word for the following:a. A sort of constructor in Python ______b. A region of a Python program where a namespace is directly accessible.______c. It returns the docstring of a class.______d. It returns the string representation of the object. ______e. A method used to delete an attribute. ______Answer:a. _init_b. scopec. _doc_d. _str_e. _delattr_ ()
Question 2:Define a namespace. Give examples of namespaces with respect to Python.Answer:Namespace is a mapping from names to objects. Examples of namespaces are built-in names, global names in a module and local names in function invocation.
Question 3:What is the significance of super method? Give on example of the same.Answer:super ( ) function is used to call base class methods which has been extended in derived class.Example :class GradStudent (Student):def_ init _(self) :super (GradStudent, self). _init _( )self. subject = â âself. working = â âdef readGrad (self) :# Call readStudent method of parent class super (GradStudent, self). readStudent ( )
Question 4:Explain LEGB rule.Answer:LEGB rule: when a name is encountered during the execution of the program , it searches for that name in the following order:L. Local â It first makes a local search, i.e. in current def statement.E. Enclosing functions â It searches in all enclosing functions, form inner to outer.G. Global (module) â It searches for global modules or for names declared globalB. Built-in (Python) â Finally it checks for any built in functions in Python.
Question 5:Is object of a class mutable? Why/why not?Answer:User classes are considered mutable. Python doesnât have (absolutely) private attributes, so you can always change a class.
Question 6:Explain the usage of keyword âpassâ in class definition.Answer:When a class doesnât define any methods or attributes, but syntactically, there needs to be something in the definition, so we use pass. It is a statement that does nothing, and is a good placeholder when you are stubbing out functions or classes.
Question 7:What is the use of _init_ ? When is it called? Explain with an example.Answer:
_init_ help to create objects and instances to the parent class.
It reserve the memory to the members of the class.
Question 8:Explain the importance of self in Python classes.Answer:self is an object reference to the object itself, therefore, they are same. Python methods are not called in the context of the object itself, self in Python may be used to deal with custom object models.
Question 9:Differentiate between class attributes and instance attributes.Answer:The difference is that the attribute on the class is shared by all instances. The attribute on an instance is unique to that instance.
Question 10:Explain _str_ with an example.Answer:_str_ , returns a string representation of a Point object. If a class provides a method named _str_ , it overrides the default behavior of the Python built-in _str_ function.>>> p = Point(3, 4)>>> str(p)â(3,4)âPrinting a Point object implicitly invokes _str_ on the object, so*- defining _str_ also changes the behavior of print:>>> p = Point(3,4)>>> print p(3,4)
Question 11:What do you mean by name mangling? Support your answer with relevant example.Answer:Name mangling of the double underscore makes the most sense for achieving âprivate-nessâ. Now when a function is called from the âselfâ instanceand it notices that it starts with â_â, it just performs the name mangling right there. Name mangling is helpful for letting sub-classes override methods without breaking intra class method calls.
Question 12:Differentiate between reference counting and automatic garbage collection with respect to Python.Answer:Reference counting works by counting the number of times an object is referenced by other objects in the system. Pythonâs garbage collector runs during program execution and is triggered when an objectâs reference count reaches zero. An objectâs reference count changes as the number of aliases that point to it change. An objectâs reference count increases when it is assigned a new name or placed in a container (list, tuple or dictionary). The objectâs reference count decreases when it is deleted with del, its reference is reassigned, or its reference goes out of scope. When an objectâs reference count reaches zero, Python collects it automatically.Automatic garbage collectiomPython deletes the objects which are not required, may it be built-in types or class instances, through the process named garbage collection. When the number of allocations minus the number of de-allocations are greater than the threshold number, the garbage collector is run and the unused block of memory is reclaimed.One can inspect the threshold for new objects by loading the garbage collector (gc) module and asking for garbage collection thresholds.
Question 13:Predict the output of the following code snippet:ptr=40def result():print ptrptr=90def func(var):if var<=60:ptr=30print ptrresult()func(60)func(70)Answer:UnboundLocalError: local variable âptrâ referenced before assignment.
Question 14:What is the difference between Multilevel inheritance and multiple inheritance? Give suitable examples to illustrate.Answer:
Question 15:How do you implement abstract method in Python? Give an example for the same.Answer:Abstract method : An unimplemented method is an abstract method. When an abstract method is declared in a base class, the drived class has to either difine the method or raiseâ Nothlmplemented Errorâclass Shape (object):def findArea (self):passclass Square (Shape):def_ init_(self, side):self, side = sidedef find Area (self):return self.side*self.sideNote:Â We can use @ abstract method to enable parent class method to be executed.
Question 16:Predict the output of the following code snippet:ptr=50def result():global ptrptr=ptr+1print ptr result()print ptrAnswer:5151
Question 17:Name the methods that can be used to:
access attribute of an object
delete an attribute of an object
Answer:
getattr(obj, name[, default])
delattr(obj, name)
Question 18:Give the statement to:
Check whether the attribute str exists in the class Test whose object is T
Assign a value âHelloâ to the attribute str of class Test and object Tl.
Answer:
hasattr (Tl,str)
setattr (Tl, str, âHelloâ)
Question 19:Predict the output of the following code:class Match:#âRuns and Wicketsâruns=281wickets=5def init (self,runs, wickets) :self.runs=runsself.wickets=wicketsprint âRuns scored are :â ,runsprint âWickets taken are :â .wicketsprint âTest. do :â, Match. docprint âTest._name_ , Match. _name_print âTest_module_ , Match.__module_print âTest. _bases_ , Match._bases_print âTest._dict_ , Match. _diet_Answer:Runs scored are : 281Wickets taken are : 5Test._ do_ : NoneTest._name_ : MatchTest._module_ : mainTest._bases_ : ()Test. _diet_ : {â _module _â: â_ main_ â, â_doc _â: None, ârunsâ: 281, â_init_ â:<function _init_ at 0x0000000002DDFBA8>, âwicketsâ: 5}
Long Answer Type Questions (4 marks)
Question 1:Write a class customer in Python Containing Deduct % Mark to be deducted if caldiscount () is following specifications. not invoked properly
Instance attributes: inside input( ) functioncustomernumber â numeric value No mark to be deducted if member functioncustomemame â string value definitions are written inside the class
price, qty discount, totalprice, netprice â numeric valuemethods :Â
init()-To assign initial values of customernumber as 111, customemame as âLeenaâ, qty as 0 and price, discount & netprice as 0.
caldiscount ( ) â To calculate discount, totalprice and netpricetotalprice = price * qty
discount is 25% of totalprice, if totalprice >=50000
discount 15% of totalprice, if totalprice >=25000 and totalprice <50000
discount 10% of totalprice, if totalprice <250000netprice= totalprice â discount
input()-to read data members customer- name, customernumber, price, qty and call caldiscount() to calculate discount, totalprice and netprice.
show( ) â to display Customer details.
Answer:
class customer:def _init_(self):self.customemumber=111self.customemame=âLeenaâself.qty=0self.price=0self.discount=0self.netprice=0def caldiscount(self):totalprice = self.price*self.qtyif totalprice >= 50000:self.discount=totalprice * 0.25elif totalprice >= 25000:self.discount = totalprice * 0.15 else:self.discount = totalprice * 0.10self.netprice = totalprice â self.discountdef input(self):self.customernumber=input(âEnter Customer Numberâ)self.customemame = raw_input(âEnter Customer Nameâ)self.qty = input(âEnter Quantityâ)self.price = input(âEnter Priceâ)self.caldiscount()def show(self):print âCustomer Numberâ,self.customernumberprint âCustomer Nameâ,self.customemameprint âQuantityâ,self.quanti-typrint âPriceâ,self.priceprint âDiscountâ,self.discountprint âNet priceâ,self.netpricec = customer()c.inputO c.show()
Question 2:Create the class SOCIETY with following information:society_name,house_no,no_of_members,flat, incomeMethods :
An _init_ method to assign initial valuesof society_name as âSurya Apartmentsâ, flat as âATypeâ, house_.no as 20, no_of_ members as 3, income as 25000.
Inputdata()-To read data members(society,house_no,no_of members & income) and call allocate_flat().
allocate_flat( )-To allocate flat according to income
ShowData() to display the details of the entire class.
Answer:class SOCIETY:# constructor to create an objectdef init (self):#constructorself. society_name=âSurya Apartmentsâself.house_no=20self.no_of_members=3self.flat=ATypeâself.income=25000def Inputdata(self):self. society_name = raw_input (âEnter Society Nameâ)self.house_no=input(âEnter House Numberâ)self.no_of_members = input (âEnter No. of membersâ)self.income = float(raw_input (âEnter incomeâ))def Allocate_Flat(self):if self.income >= 25000:self.flat = ATypeâelif self.income >= 20000 and self.income < 25000 :self.flat = âBTĂżpeâ else:self.flat = âCTypeâdef Showdata(self):print âSociety Nameâ,self.society_nameprint âHouse_Noâ,self.house_no print âNo.of membersâ,self.no_of mem-bersprint âFlat Typeâ,self.flat print âIncomeâ,self.incomeS = SOCIETY))S.InputdataOS.Allocate_Flat()S.ShowdataO
Question 3:Define a class ITEMINFO in Python with the following description:ICode (Item Code), Item (Item Name), Price (Price of each item), Qty (quantity in stock)Discount (Discount percentage on the item), Netprice (Final Price)Methods
A member function FindDisc( ) to calculate discount as per the following rules:If Qty< = 10Discount is 0If Qty (11 to 20)Discount is 15If Qty > =20Discount is 20
A constructor init method) to assign the value with 0 for ICode, Price, Qty, Netprice and Discountand null for Item respectively
A function Buy( ) to allow user to enter values for ICode, Item, Price, Qty and call function FindDisc( )to calculate the discount and N etprice(Price * Qty-Discount).
A Function ShowAll( ) to allow user to view the content of all the data members.
Answer:class ITEMINFO:#constructor to create an .objectdef_init_(self):#constructorself.ICode=0self.Item=â âself.Price=0.0self.Qty=â âself.Discount=0self.Netprice=0.0def Buy(self):self.ICode=input(âEnter Item Codeâ)self. Item=raw_input(âEnter Item Nameâ)self.Price=float(raw_input(âEnter Priceâ))self.Qty=input(âEnter Quantityâ)def FindDisc(self):if self.Qty <= 10:self.Discount = 0elif self.Qty >= 11 and self.Qty < 20 :self.Discount = 15else:self.Discount = 20self.Netprice= (self.Price*self.Qty)self.Discountdef ShowAll(self):print âItem Codeââ,self.ICodeprint âItem Nameâ,self.Itemprint âPriceâ,self.Priceprint âQuantityâ,self.Qtyprint âNetPriceâ,self.NetpriceI = ITEMINFO()I.Buy()I.FindDisc()I. Show All ()
Question 4:Define a class PRODUCT in Python with the following specifications :Data members:Pid â A string to store product.Pname -A string to store tha name of the product. Peostprice â A decimal to store the cost price of the productPsellingprice â A decimal to store Selling Price Margin- A decimal to be calculated as Psellingprice- PcostpriceRemarks- To store âProfitâ if Margin is positive else âLossâ if Margin is negativeMember Functions :
A constructor to intialize All the data members with valid default values.
A method SetRemarks() that assigns Margin as Psellingprice â Peostprice and sets Remarks as mentioned below :
A method Getdetails() to accept values for Pid. Pname,Psellingprice and invokes SetRemarks() method.
A method Setdetails () that displays all the data members.
Answer:class PRODUCT:def init (self):self. Pid = self. Pname = self. Peostprice = 0.0 self. Psellingprice = 0.0 self. Margin = 0.0 self. Remarks = def SetRemarks (self) :self . Margin = self.Psellinrprice-self. Peostpriceif (self.Margin < 0) :self. Ramarks = âLossâelse:self. Remarks = âProfitâ defGetdetails (self):self.Pid = rawjnput (âEnter Product Idâ)self.Pname = rawjnput (âEnter Product Nameâ)self.Peostprice = input (âEnter Cost Priceâ)self.Psellingprice = input (âEnter Selling Priceâ)self. SetRemarks ( ) def Setdateils (self) :print âProduct Idâ ,self.Pid print âProduct Nameâ,self.Pname print âCost Priceâ,self.Pcostprice print âSelling Priceâ,self.Esellingprice print âMargin : â ,self.Margin print âIncurred :â ,self.Remarks
Question 5:Write a Python program using classes and objects to simulate result preparation system for 20 students. The data available for each student includes: Name, Rollno, and Marks in 3 subjects. The percentage marks and grade are to be calculated from the following information:Also demonstrate constructor overloading.Answer:# constructor to create an objectdef init (self,s=None):#non-copy constructor if s==None:self.rollno = 0 self.name =Â â âself.marks = [0,0,0]self.avg = 0.0 self.grade = â â# copy constructor else:self.rollno = s.rollno self.name = s.name self.marks = s.marks self.avg = s.avgself.grade = s.gradedef read (self):# This function gets the details of a student from the userselfrollno=iaw_input(âEnter roll number.-â)self.name = raw_input(âEnter name:-â) s=0for i in range(0,3):self.marks [i] = int(r a w_input (âEnter the marks ?â)) s = s + self.marksfi] self.avg = s/3if(self.avg>60):self.grade=âAâelif self.avg>40:self.grade=âBâelse:self.grade=âCâdef display (self):# This function prints each studentâs detailsprint self.rollno,â\tâ, self, name, â\t\ tâ,self.grade s = StudentO studlist = []num = int(raw_input(âEnter no. of students:-ââ))for i in range(O.num):s.read()studlist. append(Student(s))print â STUDENT REPORT \nâprint â***********************************\nâprint âRollNo \t Name \t\t Gradeâprint â*******************************************\nâfor i in range(0,num):studlist[i] .displayO#Initialize avg as the first studentâs avg maxavg = studlist[0].avg totavg = 0for i in range(l.num):totavg = totavg + studlist[i].avg if studlist[i].avg > maxavg: maxavg = studlist[i].avg topper = studlist[i].name totavg = totavg/numprint âClass topper isâ,studlist[i],name,âwith averageâ, studlist [i]. avgprint âClass average isâ,totavgclass Student:
Question 6:Define a class SUPPLY in Python with the following description:Private Members Code of type int FoodName of type string FoodType of type string Sticker of type stringA member function GetType() to assign the following values for Food Type as per the given Sticker
A function Foodln() to allow user to enter values for Code, EoodName, Sticker and call function GetType() to assign respective FoodType.
A function FoodOut() to allow user to view the contents of all the data members.
Answer:class SUPPLY:⢠constructor to create an objectdef init (self) :#constructorself.FoodCode=()self.FoodName=â âself.FoodType=â âself.Sticker=â âdef Foodln(self):self.FoodCode=input(âEnter Food Codeâ)self.FoodName=raw_input(âEnter Food Nameâ)self.Sticker=raw_input(âEnter Sticker Colourâ)def GetType(self):if self.Sticker==âGREENâ:self.FoodType = âVegetarianâelif self.Sticker==âYELLOWâ:self.FoodType = âContains Eggâelif self.Sticker==âREDâ:self.FoodType = âNon-Vegetarianâ else:self.FoodType = âNot Knownâdef FoodOut(self):print âFoodCodeââ,self.FoodCodeprint âFoodNameâ,self.FoodNameprint âFoodTypeâ,self.FoodTypeprint âStickerâ,self.StickerS = SUPPLY()S.FoodIn()S.GetTĂżpe()S.FoodOut()
TOPIC-3InheritanceVery Short Answer Type Questions (1 mark)
Question 1:Give one example for an abstract method.Answer:An abstract method is a method declared in a parent class, but not implemented in it. The implementation of such a method can be given in the derived class, class circle(object):def getradius(self):
Question 2:Define the term inheritance.Answer:Inheritance is a mechanism in which a new class is derived from an already defined class. The derived class is known as a subclass or a child class. The pre-existing class is known as base class or a parent class or a super class. The mechanism of inheritance gives rise to hierarchy in classes. The major purpose of inheriting a base class into one or more derived class is code reuse. The subclass inherits all the methods and properties of the super class.
Question 3:What is single inheritance?Answer:In single inheritance a subclass is derived from a single base class.
Question 4:What is multiple inheritance? Explain with an example.Answer:In this type of inheritance, the derived class inherits from one or more base classes. In the figure below, X and Y are the base classes while Z is the derived class.
Question 5:Give one example of multilevel inheritance.Answer:In multilevel inheritance, the derived class becomes the base of another class.For example, Country is the base class of State and City is the derived class of State.
Short Answer Type Questions (2 marks)
Question 1:Based on the diagram, answer the following:
Write the name of the base class and the derived classes.
Write the type of inheritance depicted in the above diagram.
Answer:
Base class â Furniture; Derived classes â Sofa & Cot
Hierarchical inheritance
Question 2:Explain the concept of overriding methods.Answer:Overriding is a very important part of OOB since it is the feature that makes inheritance exploit its full power. Through method overriding, a class may âcopyâ another class, avoiding duplicated code, and at the same time enhance or customize part of it.
Question 3:Based on the diagram, answer the following:
Write the name of the base class and derived class of state.
Write the type of inheritance depicted in the diagram.
Answer:
Base class of state â CountryDerived class of state â City
Multilevel inheritance
Question 4:What are the different ways of overriding function call in derived class of python? Illustrate with example.Answer:Overriding enables the programmer to provide specific implementation to a method in the derived class. So, the method invoked depends on the object used to invoke it. If base class object is used then base class version of the method is called else the derived class method is called, class Parent:def func(self):print âParent methodâ class child:def func(self):print âchild methodâC = child()c.func() # child calls overridden method
Question 5:How do we implement abstract method in Python?Support your answer with an example.Answer:An abstract method is a method defined in a base class, but that may not provide any implementation. It is done by using the abc module in Python, import abcclass Shape(object):metaclass = [email protected] method_to_implement(self, input):âââââMethod documentationreturn
Question 6:Find the output of the following code and write the type of inheritance:p=Gstudent(âMonaâ, 20,12, $9, âcomputerâ)def_init_(self, name, age, roll no, marks, stream):super (Gstudent, self) _init_(name, age, roll no, marks)self stream=streamdef display 2 (self):self display()print âstream:â,self.stream P=Gstudent (âMonaâ, 20,12, 99, âComputerâ)p.display2()Answer:TVpe of inheritance: Multilevel Output:Name : MonaAge : 20Roll No: 12Marks : 99stream: computer
Question 7:Rewrite the following code after removing errors. Underline each correction and write the output after correcting the code:class First():def _init_ (self):print âfirstâ:class Second(object):def _init_ (self):print âsecondâ class Third(First, Second):def _init_ (self):First. _init_ (self):Second. _init_ (self):print âthatâs itât=Third()t=Third()Answer:class First():def _init_ (self):print âfirstâclass Second(object):def_ init_(self):print âsecondâ class Third(First, Second):def _init_ (self):First._init_ (self)Second._init_(self)print âthatâs itât=Third()t=Third()
Question 8:Complete the following code:class employee(object):def _init_(self,no,name,age):self.no=noself.name=___ #complete the statementself.age= ___ #complete the statementdef printval(self):print âNumber:â,self.no print âName :â,self.name print âAge :â,self.age class pay(object):def _init_ (self,dept,salary): #completethe definition__________________def display(self): #complete the definition______ # call printval()______ # print dept______ # print salaryAnswer:class employee (object):def init (self,no,name,age):self.no=noself.name=nameself.age=agedef printval(self):print âNumber:â,self.no print âName :â,self.nameprint âAge :ââ,self.ageclass pay(object):def _init_ (self,dept,salary):self.dept =deptself.salary=salarydef display(self)self.printval()print self.deptprint self.salary
Long Answer Type Questions (4 marks)
Question 1:Write a Python program to demonstrate multiple inheritance. Consider 3 classes with the following description.Student class has 3 protected data members roll number, markl and mark2 of type integer. It has a get() function to get these details from the user. Sports class has a protected data member sports marks of type integer and a function getsm() to get the sports mark.Statement class uses the marks from Student class and the sports marks from the Sports class to calculate the total and average and displays the final resultAnswer:class student(object):# constructor to create an object def init (self):self.mo=0self.m1=0self.m2=0def get(self):self.mo=int(raw_input(âEnter the Roll no:â))print âEnter 2 marksâself.m1=int(raw_input(âMarkl?â))self.m2=int(raw_input(âMark2 ?â))classsports(object):# Sports markdef_init_(self):self.sm=0def getsm(self):self.sm=int(raw_input(âEnter the sports mark:â))class statement(student,sports):def_init_(self):super(statement,self)._init_()def display (self):tot=(self.ml+self.m2+self.sm); avg=tot/3;printâ\n\n\tRoll No. : â,self.mo,â\n\tTotal :â,tot printâ\tAverage : â,avgobj=statement()obj.get()obj.getsm()obj. display()
Question 2:SKP Hotel offers accommodation, meals facilities.Create a class Accommodation with Room Number, type of room, and rent, etc..Create a class meals services includes: meals code, name, price, etc..Create a class customer with customer number, name, address, etc.Customer class is derived by using Accommodation and meals classes.Answer:class Accommodation(object):# constructor to create an objectdef_init_(self):self.roomno=0self.roomtype=âself.roomrent=0.0defgetroom(self):self.roomno=input(âEnter the Room no:â)self.roomtype=rawjnput(âEnter the Room type:â)self.roomrent=float(raw_input(âEnter Room Rentâ))class Meals(object):# Meals classdef_init_(self):self.mealcode=0self.mealname=ââself.mealprice=0.0def getmeals(self):self.mealcode=input(âEnter the meal code:â)self.mealname=raw_input(âEnter the meal name:â)self.mealprice=float(raw_input(âEnter the meal priceâ))class Customer(Accommodation,Meals):def_init_(self):super(Customer,self)._init_()self.custnum=0self.custname=â âself.address=â âdef getCustomer(self):self.custnum=input(âEnter the customer numberâ)self.custname=raw_input(âEnter customer nameâ)self. address=raw _input(âEnter customer addressâ)def displaybill(self):printâCustomer Name:â,self.custname,âAddress:â, self, addressprintâRoom No:â,self.roomno,âRoom Type:â,self.roomtype,âRoom Rent: Rsâjself.roomrentprintâMeal Name:â,self.mealname,âPrice:â,self.mealpriceprintâTotal Amount Due:â,self.roomrent+ self.mealpriceobj=Customer()obj.getCustomer()obj.getroom()obj.getmeals()obj.displaybill()
Question 3:Pay roll information system:Declare the base class âemployeeâ with employeeâs number, name, designation, address, phone number. Define and declare the function getdata() and putdata() to get the employeeâs details and print employeeâs details. Declare the derived class salary with basic pay, DA, HRA, Gross pay, PF, Income tax and Net pay. Declare and define the function getdatal() to call getdata() and get the basic pay. Define the function calculate() to find the net pay. Define the function display() to call putdata() and display salary details .Create the derived class object. Read the number of employees. Call the function getdatal)) and calculate() to each employees. Call the display() function.Answer:class employee (object):# constructor to create an objectdef init (self):self.eno=0self.name=â âself.designation=â âself.address = â âself.phonenumber=0def getdata(self):self.eno=input(âEnter Employee Numberâ)self.name=raw_input(âEnter Employee Nameâ)self.designation=raw_input(âEnter Employee Designationâ)self.address = raw_input(âEnter Employee Addressâ)self.phonenumber=input(âEnter Employee Phone Numberâ)def putdata (self):print âEmployee Numberâ,self.enoprint âEmployee Nameâ,self.nameprint âEmployee Designationâ,self.designationprint âEmployee Addressâ,self.addressprint âEmployee Phone Numberâ,self phonenumberclass salary (employee):# Salary detailsdef_init_(self):super(salaryself)._init_()self.basic=0self.DA=0self.HRA=0self.Gross=0self.PF=0self.tax=0self.netpay=0def getdatal(self): self.getdata()self.basic=float(raw_input(âEnter the basic payââ))self.DA=float(raw_input(âEnter the DAâ))self.HRA=float(raw_input(âEnter the HRA))self.PF = float(raw_input(âEnter the PFâ))def calculate(self):self.Gross= self.basic + self.FĂŽRA + self.DAif .self. Gross < 100000:self.tax=0elif self.Gross < 500000:self.tax=self.Gross*0.10elif self.Gross < 1000000:self.tax=self.Gross*0.15else:self.tax=self.Gross*0.20self.netpay= self.Gross â self.PF â self.taxdef display(self):self.putdataOprint âGross Incomeâ,self.Grossprint âTax â,self.taxprint âNet Incomeâ,self.netpaysalaryobj =salary()num = int(raw_input(âEnter no. of employees:-â))for i in range(0,num):salaryobj.getdatal()salaryobj.calculate()salaryobj.display()
Question 4:Define a class employee in Python with the given specifications:Instance variables:Employee number, name Methods:Getdata()- To input employee number and namePrintdata()- To display employee number and nameDefine another class payroll, which is derived from employeeInstance variable Methods:Inputdata() â To call Getdata() and input salary.Outdata() â To call Printdata() and to display salary.Define another class leave, which is derived from payroll.Instance variable No of days Methods:acceptdata() â To call Inputdata() and input no of days.showdata() â To call Outdata() and to display no of days.Implement the above program in python.Answer:class Employee(object):# constructor to create an objectdef_init_(self):self.eno=0self.name=ââdef Getdata(self):self.eno=input(âEnter the Employee no:â)self.name= raw_input(âEnter the Employee Name:â)def Printdata(self):print âEmployee Numberâ,self.eno print âEmployee Nameâ,self.nameclass payroll(Employee):def_init_(self):super(payroll,self). _init_()self.salary=0def Inputdata(self): self.GetdataQself.salary=float(raw_input(âEnter the salary:â))def Outdata(self): self.Printdata()print âSalary isâ,self.salaryclass leave(payroll):def_init_(self):super(leave,self)._init_()self.Noofdays=0 def acceptdata(self):self.Inputdata()self.Noofdays =input(âEnter leave daysâ)def showdata(self): self.Outdata()print âNo. of leave daysâ,self.Noofdays leaveobj = leave()leaveobj. acceptdataOleaveobj.showdata()
Question 5:Â What output will be generated when the following Python code is executed?def changeList () :L = []LI = [ ]L2 = []for i in range (10,1, -2) :LI append (i)for i in range (len ( LI)) :L2. append (LI [i] + L [i] )print L2ChangeList ( )Answer:[11, 10,9, 8, 7,4]
via Blogger https://ift.tt/3hs8vzC
0 notes
Text
NCERT Class 12 Computer Science Chapter 1 Review of Python
NCERT Class 12 Computer Science Python Solutions for Chapter 1 :: Review of Python
TOPIC-1
Python Basics
Very Short Answer Type Questions(1 mark)
Question 1.Name the Python Library modules which need to be imported to invoke the following functions:
load ()
pow () [CBSE Delhi 2016]
Answer:
pickle
math
Question 2.Name the modules to which the following func-tions belong:
Uniform ()
fabs () [CBSE SQP 2016]
Answer:
random ()
math ()
Question 3.Differentiate between the round() and floor() functions with the help of suitable example.[CBSE Comptt. 2016]Answer:The function round() is used to convert a fractional number into whole as the nearest next whereas the function floor() is used convert to the nearest lower whole number, e.g.,round (5.8) = 6, round (4.1) = 5 and floor (6.9) = 6, floor (5.01) = 5
Short Answer Type Questions (2 marks):
Question 1.Out of the following, find those identifiers, which cannot be used for naming Variables or functions in a Python program:Total * Tax, While, Class, Switch, 3rd Row, finally, Column 31, Total. [CBSE Outside Delhi-2016]Answer:Total * Tax, class, 3rd Row, finally
Question 2.Name the Python Library modules which need to be imported to invoke the follwing functions :
sqrt()
dump() (CBSE Outside Delhi-2016)
Answer:
math
pickle
Question 3.Out of the following, find the identifiers, which cannot be used for naming Variable or Functions in a Python program:Â [CBSE Delhi 2016]_Cost, Price*Qty, float, switch, Address one, Delete, Number12, doAnswer:Price *Qty, float, Address one, do
Question 4.Out of the following find those identifiers, which can not be used for naming Variable or Functions in a Python Program:Days * Rent, For, A_price, Grand Total, do, 2Clients, Participantl, My cityAnswer:Illegal variables or functions name are as below: Days * Rent, do, 2Clients, For and Grant Total Because of being either keyword or including space or operator or starting with integar.
Question 5.Name the function / method required for [CBSE SQP 2015]
Finding second occurrence of m in madam.
get the position of an item in the list.
Answer:
find
index
Question 6.Which string method is used to implement the following:
To count the number of characters in the string.
To change the first character of the string in capital letter.
To check whether given character is letter or a number.
To change lowercase to uppercase letter.
Change one character into another character. [CBSE TextBook]
Answer:
len(str)
str.capitalize()
ch.isalnum()
str.upper()
str.replace(old,new)
Question 7.What is the difference between input() and raw_input()?Answer:raw_input() takes the input as a string whereas input() basically looks at what the user enters, and automatically determines the correct type. We use the inputQ function when you are expecting an integer from the end-user, and raw_input when you are expecting a string.
Question 8.What are the two ways of output using print()?Answer:Ordinarily, each print statement produces one line of output. You can end the print statement with a trailing â to combine the results of multiple print statements into a single line.
Question 9.Why does the expression 2 + 3*4 result in the value 14 and not the value 24?Answer:Operator precedence rules* make the expression to be interpreted as 2 + (3*4) hence the result is 14.
Question 10.How many times will Python execute the code inside the following while loop? You should answer the question without using the interpreter! Justify your answers.
i = 0 while i < 0 and i > 2 : print âHello ...â i = i+1
Answer:0 times.
Question 11.How many times will Python execute the code inside the following while loop?
i = 1 while i < 10000 and i > 0 and 1: print â Hello ...â i = 2 * i
Answer:14.
Question 12.Convert the following for loop into while loop, for i in range (1,100):
if i % 4 == 2 : print i, âmodâ, 4 , â= 2â
Answer:
i=1 while i < 100: if i % 4 == 2: print i, âmodâ, 4 , â= 2â i = i +1
Question 13.Convert the following for loop into while loop.
for i in range(10): for j in range(i): print '$', print"
Answer:
i=0 while i < 10: j=0 while j < i: print '$â print"
Question 14.Rewrite the following for loop into while loop: [CBSE Text Book]
for a in range(25,500,25): print a
Answer:
a=25 while a < 500: print a a = a + 25
Question 15.Rewrite the following for loop into while loop: [CBSE Text Book]
for a in range(90, 9, -9): print a
Answer:
a = 90 while a > 9: print a a = a-9
Question 16.Convert the following while loop into for loop:
i = 0 while i < 100: if i % 2 == 0: print i, âis evenâ else: print i, âis oddâ i = i + 1
Answer:
for i in range(100): if i % 2 == 0: print i, âis evenâ else : print i, âis oddâ
Question 17.Convert the following while loop into for loop
char = "" print âPress Tab Enter to stop ...â iteration = 0 while not char == â\tâ and not iteration > 99: print âContinue?â char = raw_input() iteration+ = 1
Answer:
char = "" print âPress Tab Enter to stop ...â for iteration in range(99): if not char == â\tâ: print âContinue?â char = raw_input()
Question 18.Rewrite the following while loop into for loop:
i = 10 while i<250: print i i = i+50
Answer:
for i in range(10, 250, 50): print i
Question 19.Rewrite the following while loop into for loop:
i=88 while(i>=8): print i i- = 8
Answer:
for i in range(88, 9, -8) print i
Question 20.Write for statement to print the series 10,20,30, âŚâŚ., 300Answer:
for i in range(10, 301, 10): print i
Question 21.Write for statement to print the series 105,98,91,⌠.7Answer:
for i in range(105, 8, -7): print i
Question 22.Write the while loop to print the series: 5,10,15,âŚ100Answer:
i=5 while i <= 100: print i i = i + 5
Question 23.How many times is the following loop executed? [CBSE Text Book]for a in range(100,10,-10):print aAnswer:9 times.
Question 24.How many times is the following loop executed? [CBSE Text Book]
i = 100 while (i<=200): print i i + =20
Answer:6 times
Question 25.State whether the statement is True or False? No matter the underlying data type if values are equal returns true,
char ch1, ch2; if (ch1==ch2) print âEqualâ
Answer:True. Two values of same data types can be equal.
Question 26.What are the logical operators of Python?Answer:or, and, not
Question 27.What is the difference between â/â and â//â ?Answer:
// is Integer or Floor division whereas / is normal division (eg) 7.0 // 2 â 3.0 7.0/2 â 3.5
Question 28.How can we import a module in Python?Answer:1. using import
Syntax: import[,,...] Example: import math, cmath
2. using from
Syntax: fromimport[, ,.. ,] Example: . from fib. import fib, fib2.
Question 29.What is the difference between parameters and arguments?Answer:
S.No.ParametersArguments1Values provided in function headerValues provided in function call.2(eg) def area (r):â> r is the parameter(eg) def main() radius = 5.0 area (radius)â> radius is the argument
Question 30.What are default arguments?Answer:Python allowes function arguments to have default values; if the function is called without the argument, the argument gets its default value
Question 31.What are keyword arguments?Answer:If there is a function with many parameters and we want to specify only some of them in function call,then value for such parameters can be provided by using their names instead of the positions. These are called keyword argument.
(eg) def simpleinterest(p, n=2, r=0.6) ' def simpleinterest(p, r=0.2, n=3)
Question 32.What are the advantages of keyword arguments?Answer:It is easier to use since we need not remember the order of the arguments.We can specify the values for only those parameters which we want, and others have default values.
Question 33.What does âinâ do?Answer:âinâ is a membership operator. It evaluates to true if it finds a variable/string in the specified sequence :Otherwise i+evaluates to false.
(eg) S = âHello World" if âHellâ in S: print âTrueâ will print True.
Question 34.What does ânot inâ do?Answer:ânot inâ is a membership operator. It evaluates to true if it does not finds a variable/stringin the specified sequence. Otherwise it evaluates to false,
(eg) S = âHello Worldâ if âHellâ not in S: print âFalseâ will print False.
Question 35.What does âsliceâ do?Answer:The slice[n:m] operator extracts subparts from a string. It doesnât include the character at index m.
(eg) S = âHello Worldâ print s[0:4] â Hell
Question 36.What is the use of negative indices in slicing?Answer:Python counts from the end (right) if negative indices are given.
(eg) S = âHelloâ print S[:-3] >> He print S[-3:] >> llo
Question 37.Explain find() function?Answer:find (sub[,start[,end]])This function is used to search the first occurrence of the substring in the given string.It returns the index at which the substring starts. It returns -1 if the substring doesnât occur in the string.
(eg) str = âcomputerâ - str.findf("omâ) â 1
Question 38.What are the differences between arrays and lists?Answer:An array holds fixed number of values. List is of variable-length â elements can be dynamically added or removedAn array holds values of a single type. List in Python can hold values of mixed data type.
Question 39.What is the difference between a tuple and a list?Answer:A tuple is immutable whereas a list is a mutable.A tuple cannot be changed whereas a list can be changed internally.A tuple uses parenthess (()) whereas a list uses square brackets ([]).tuple initialization: a = (2, 4, 5)list initialization: a = [2, 4, 5]
Question 40.Carefully observe the following python code and answer the question that follows:x=5def func2():x=3global xx=x+1print xprint xOn execution the above code produces the following output.63Explain the output with respect to the scope of the variables.Answer:Names declared with global keyword have to be referred at the file level. This is because the global scope.If no global statement is being used the variable with the local scope is accessed.Hence, in the above code the statement succeeding the statement global x informs Python to incrementthe global variable xHence, the output is 6 i.e. 5 + 1 which is also the value for global x.When x is reassingned with the value 3 the local x hides the global x and hence 3 printed.(2 marks for explaning the output) (Only 1 mark for explaining global and local namespace.)
Question 41.Explain the two strategies employed by Python for memory allocation. [CBSE SQP 2016]Answer:Pythonuses two strategies for memory allocation-(i) Reference counting(ii) Automatic garbage collectionReference Counting: works by counting the number of times an object is referenced by other in the system.When an objectâs reference count reaches zero, Python collects it automatically.Automatic Garbage Collection: Python schedules garbage collection based upon a threshold of object allocations and object deallocations. When the number of allocations minus the number of deallocations are greater that the threshold number, the garbage collector is run and the unused blocks of memory is reclaimed.
TOPIC â 2Writing Python Programs
Question 1.Rewrite the following code in Python after removing all syntax errors(s). Underline each correction done in the code. [CBSE Delhi-2016]for Name in [Amar, Shveta, Parag]if Name [0] = âsâ:Print (Name)Answer:
for Name in [â_Amarâ, â_Shveta_â , "_Parag_â] : if Name [0] E == âSâ : Print (Name)
Question 2.Rewrite the following code is Python after removing all syntax errors(s).Underline each correction done in the code. [CBSE Outside Delhi-2016]for Name in [Ramesh, Suraj, Priya]if Name [0] = âSâ:Print (Name)Answer:
for Name in [â_Ramesh_â, â_Suraj_â , â_Priya_â] if Name [0] =_=âSâ : print (Name)
Question 3.What will be the output of the following python code considering the following set of inputs?AMARTHREEA1231200Also, explain the try and except used in the code.Start = 0while True :Try:Number = int (raw input (âEnter Numberâ))breakexcept valueError : start=start+2print (âRe-enter an integerâ)Print (start)Answer:Output:
Enter Number AMAR Re-enter an integer Enter Number THREE Re-enter an integer Enter Number A123 Re-enter an integer Enter Number 12006
Explanation : The code inside try makes sure that the valid number is entered by the user.When any input other an integer is entered, a value error is thrown and it prompts the user to enter another value.
Question 4.Give the output of following with justification. [CBSE SQP 2015]
x = 3 x+ = x-x print x
Answer:Output: 3Working:
x = 3 x = (x+ x-x ):x = 3 + 3 - 3 = 3
Question 5.What will be printed, when following Python code is executed? [CBSE SQP 2015]
class person: def init (self,id): self.id = id arjun = person(150) arjun. diet [âageâ] = 50 print arjun.age + len(arjun. diet )
Justify your answer.Answer:52arjun.age = 50arjun.dict has 2 attributes so length of it is 2. So total = 52.
Question 6.What would be the output of the following code snippets?print 4+9print â4+9âAnswer:13 (addition), 49 (concatenation).
Question 7.Highlight the literals in the following programand also predict the output. Mention the types ofvariables in the program.
a=3 b='1' c=a-2 d=a-c e=âKathyâ f=âwent to party.â g=âwith Sathyâ print a,g,e,f,a,g,â,â,d,g,â,â,c,g,âand hisâ,e,f
Answer:a, c,d = integerb, e,f,g = stringOutput: 3 with Sathy Kathy, went to party. 3 with Sathy, 2 with Sathy , 1 with Sathy and his Kathy, went to party.
Question 8.What is the result of 4+4/2+2?Answer:4 + (4/2) + 2 = 8.
Question 9.Write the output from the following code: [CBSE Text Book]
x= 10 y = 20 if (x>y): print x+y else: print x-y
Answer:â 10
Question 10.Write the output of the following code:print âPython is an \n interpreted \t LanguageâAnswer:Python is an interpreted Language
Question 11.Write the output from the following code:
s = 0 for I in range(10,2,-2): s+=I print âsum= ",s
Answer:sum= 28
Question 12.Write the output from the following code: [CBSE TextBook]
n = 50 i = 5 s = 0 while i<n: s+ = i i+ = 10 print âi=â,i print âsum=â,s
Answer:
i= 15 i= 25 i= 35 i= 45 i= 55 sum= 125
Question 13.Write the output from the following code: [CBSE TextBook]
n = 50 i = 5 s = 0 while i<n: s+ = i i+ = 10 print âi=â,i print âsum=â,s
Answer:
i= 15 i= 25 i= 35 i= 45 i= 55 sum= 125
Question 14.Observe the following program and answer the question that follows:import randomx = 3N = random, randint (1, x)for 1 in range (N):print 1, â#â, 1 + 1a. What is the minimum and maximum number of times the loop will execute?b. Find out, which line of output(s) out of (i) to (iv) will not be expected from the program?i. 0#1ii. 1#2iii. 2#3iv. 3#4Answer:a. Minimum Number = 1Maximum number = 3b. Line iv is not expected to be a part of the output.
Question 15.Observe the following Python code carefully and obtain the output, which will appear on the screen after execution of it. [CBSE SQP 2016]
def Findoutput (): L = "earn" X = " " count = 1 for i in L: if i in ['a', 'e',' i', 'o', 'u']: x = x + 1. Swapcase () else: if (count % 2 ! = 0): x = x + str (len (L[:count])) else: x = x + 1 count = count + 1 print x Findoutput ()
Answer:EA3n
Question 16.Find and write the output of the following Python code:
Number = [9,18,27,36] for N in Numbers: print (N, "#", end = " ") print ()
Answer:
ElementStack of operatorsPostfix Expression1#001#(1#)(1#)2#(1#)(1#2#)1#(2#)(1#2#3#)2#(1#)1#3#(2#)1#2#(3#)1#2#3#
Question 17.What are the possible outcome(s) executed from the following code? Also,specify the maximum and import random. [CBSE Delhi 2016]
PICK=random.randint (0,3) CITY= ["DELHI", "MUMBAI", "CHENNAI", "KOLKATA"]; for I in CITY : for J in range (1, PICK) print (I, end = " ") Print ()
(i)(ii)DELHIDELHIDELHIMUMBAIMUMBAIDELHIMUMBAICHENNAICHENNAIDELHIMUMBAICEHNNAIKOLKATAKOLKATA(iii)(iv)DELHIDELHIMUMBAIMUMBAIMUMBAICHENNAIKOLKATAKOLKATAKOLKATAKOLKATA
Answer:Option (i) and (iii) are possible option (i) onlyPICKER maxval = 3 minval = 0
Question 18.Find and write the output of the following Python code : [CBSE Outside Delhi-2016]
Values = [10,20,30,40] for val in Values: for I in range (1, Val%9): print (I," * ", end= " ") print ()
Answer:
ElementStack of operatorsPostfix Expression1*001*(1.*)(1*)2*0(1*2*)1*(1,*)(1*2*3*)2*(2.*)1*3*01*2*(1.*)1*2*3*(2,* )(3,* )
Question 19.Write the output from the following code:
y = 2000 if (y%4==0): print âLeap Yearâ else: print âNot leap yearâ
Answer:Leap Year.
Question 20.What does the following print?
for i in range (1,10): for j in'range (1,10): print i * j, print
Answer:1 2 3 4 5 6 7 8 92 4 6 8 10 12 14 16 183 6 9 12 15 18 21 24 274 8 12 16 20 24 28 32 365 10 15 20 25 30 35 40 456 12 18 24 30 36 42 48 547 14 21 28 35 42 49 56 638 16 24 32 40 48 56 64 729 18 27 36 45 54 63 72 81
Question 21.What will be the output of the following statement? Also, justify the answer.
>> print âRadhsaâs dress is prettyâ.
Answer:SyntaxError: invalid syntax.The single quote needs to be replaced by V to get the expected output.
Question 22.Give the output of the following statements :
>>> str=âHonesty is the best policyâ >>> str.replace(âoâ,â*â)
Answer:âH*nesty is the best p*licyâ.
Question 23.Give the output of the following statements :
>> str=âHello Pythonâ >>> str.istitle()
Answer:True.
Question 24.Give the output of the following statements:
>> str=âHello Pythonâ >>> print str.lstrip(âHelâ)
Answer:Hello Python
Question 25.Write the output for the following codes:
A={10:1000,20:2000,30:3000,40:4000,50:5000} print A.items() print A.keys() print A.values()
Answer:[(40,4000), (10,1000), (20,2000), (50,5000), (30,3000)] [40,10, 20, 50, 30] [4000,1000, 2000, 5000, 3000]
Question 26.Write the output from the following code:
t=(10,20,30,40,50) print len(t)
Answer:5
Question 27.Write the output from the following code:
t=(âaâ,âbâ,âcâ,âAâ,âBâ) print max(t) print min(t)
Answer:âcâAâ
Question 28.Find the output from the following code:
T=(10,30,2,50,5,6,100,65) print max(T) print min(T)
Answer:1002
Question 29.Write the output from the following code:
T1=(10,20,30,40,50) T2 =(10,20,30,40,50) T3 =(100,200,300) cmp(T1, T2) cmp(T2,T3) cmp(T3,T1)
Answer:0-11
Question 30.Write the output from the following code:
T1=(10,20,30,40,50) T2=(100,200,300) T3=T1+T2 print T3
Answer:(10,20,30,40,50,100,200,300)
Question 31.Find the output from the following code:
t=tuple() t = t +(âPythonâ,) print t print len(t) t1=(10,20,30) print len(t1)
Answer:(âPythonâ,)13
Question 32.Rewrite the following code in Python after remoÂŹving all syntax error(s).Underline each correction done in the code.
for student in [Jaya, Priya, Gagan] If Student [0] = âSâ: print (student)
Answer:for studednt in values [âJayaâ, âPriyaâ, âGaganâ]:if student [0] = = âSâprint (student)
Question 33.Find and write the output of the following Python code:
Values = [11, 22, 33, 44] for V in Values: for NV in range (1, V%10): print (NV, V)
Answer:1, 112,223,334, 44
Question 34.What are the possible outcome(s) executed from the following code? Also, specify the maximum and minimum values that can be assigned to variable SEL.
import random SEL=random. randint (0, 3) ANIMAL = [âDEERâ, âMonkeyâ, âCOWâ, âKangarooâ]; for A in ANIMAL: for AAin range (1, SEL): print (A, end =ââ) print ()
(i)(ii)(iii)(iv)DEERDEERDEERDEERDEERMONKEYMONKEYDELHIMONKEYMONKEYMONKEYMONKEYCOWCOWDELHIMONKEYCOWCOWKANGAROOKANGAROOKANGAROOKANGAROOKANGAROOKANGAROO
Answer:Maximum value of SEL is 3.The possible output is belowDEERMonkey MonkeyKangaroo Kangaroo KangarooThus (iv) is the correct option.
TOPIC-3Random Functions
Question 1.What are the possible outcome(s) executed from the following code ? Also specify the maximum and minimum values that can be assigned to variable PICKER. [CBSE Outside Delhi-2016]
import random PICKER = random randint (0, 3) COLOR = ["BLUE", "PINK", "GREEN", "RED"]: for I in COLOR : for J in range (1, PICKER): Print (I, end = " ") Print ()
(i)(ii)(iii)Â (iv)BLUEBLUEPINKSLUEBLUEPINKBLUEPINKPINKGREENPINKPINKGREENBLUEPINKGREENGREENREDGREENGREENREDBLUEPINKGREENREDREDRED
Answer:Option (i) and (iv) are possibleORoption (i) onlyPICKER maxval = 3 minval = 0
Question 2.What are the possible outcome(s) expected from the following python code? Also specifymaximum and minimum value, which we can have. [CBSE SQP 2015]
def main(): p = âMY PROGRAMâ i = 0 while p[i] != âRâ: l = random.randint(0,3) + 5 print p[l],â-â, i += 1
(i) R â P â O â R â(ii) P â O â R â Y â(iii) O -R â A â G â(iv) A- G â R â M âAnswer:Minimum value=5Maximum value=8So the only possible values are O, G, R, AOnly option (iii) is possible.
TOPIC-4Correcting The Errors
Question 1.Rewrite the following Python code after removing all syntax error(s). Underline the corrections done.[CBSE SQP 2015]
def main(): r = raw-input(âenter any radius : â) a = pi * math.pow(r,2) print â Area = â + a
Answer:
def main (): r = raw_input(âenter any radius : â) a = pi * math.pow(r,2) print â Area = â, a
Question 2.Rectify the error (if any) in the given statements.
>> str=âHello Pythonâ >>> str[6]=âSâ
Answer:
str[6] = âSâ is incorrect âstrâ object does not support item assignment. str.replace(str[6],âSâ).
Question 3.Find the errors from the following code:T=[a,b,c]print TAnswer:NameError: name âaâ is not defined .T=[âaâ,âbâ,âcâ]
Question 4.Find the errors from the following code:for i in 1 to 100:print IAnswer:for i in range (1,100):print i
Question 5.Find the errors from the following code:
i=10 ; while [i<=n]: print i i+=10
Answer:
i=10 n=100 while (i<=n): print i i+=10
Question 6.Find the errors from the following code:
if (a>b) print a: else if (a<b) print b: else print âboth are equalâ
Answer:
if (a>b) // missing colon print a: else if (a<b) // missing colon // should be elif print b: else // missing colon print âboth are equal"
Question 7.Find errors from the following codes:
c=dict() n=input(Enter total number) i=1 while i<=n: a=raw_input(âenter placeâ) b=raw_input(âenter numberâ) c[a]=b i=i+1 print âplaceâ,â\tâ,ânumberâ for i in c: print i,���\tâ,c[a[i]]
Answer:
c=dict() n=input(ââEnter total numberâ) i=1 while i<=n : a=raw_input(âenter placeâ) b=raw_inputf enter numberâ) c[a]=b i=i+1 print âplaceâ,â\tâ,ânumberâ for i in c: print i,â\tâ,c[i]
Question 8.Observe the following class definition and answer the question that follows : [CBSE SQP 2016]
class info: ips=0 def _str_(self): #Function 1 return "Welcome to the Info Systems" def _init_(Self): self. _ Sstemdate= " " self. SystemTime = " " def getinput (self): self . Systemdate = raw_input ("enter data") self , SystemTime = raw_Input ("enter data") Info, incrips () Estaiomethod # Statement 1 def incrips (): Info, ips, "times" I = Info () I. getinput () Print I. SystemTime Print I. _Systemdate # Statement 2
i. Write statement to invoke Function 1.ii. On Executing the above code, Statement 2 is giving an error explain.Answer:i. print Iii. The statement 2 is giving an error because _ Systemdate is a private variable and hence cannot to be printed outside the class.
TOPIC â 5Short Programs
Question 1.Write a program to calculate the area of a rectangle. The program should get the length and breadth ;values from the user and print the area.Answer:
length = input(âEnter lengthâ) breadth = input(âEnter breadthâ) print âArea of rectangle =â,length*breadth
Question 2.Write a program to calculate the roots of a quadratic equation.Answer:
import math a = input(âEnter co-efficient of x^2â) b = input(âEnter co-efficient of xâ) c = inputfEnter constant termâ) d = b*b - 4*a*c if d == 0: print âRoots are real and equalâ root1 = root2 = -b / (2*a) elif d > 0: print âRoots are real and distinctâ root1 = (- b + math.sqrt(d)) / (2*a) root2 = (-b - math.sqrt(d)) / (2*a) else: print âRoots are imaginaryâ print âRoots of the quadratic equation areâ,root1,âandâ,root2
Question 3.Write a program to input any number and to print all the factors of that number.Answer:
n = inputfEnter the number") for i in range(2,n): if n%i == 0: print i,âis a factor ofâ.n
Question 4.Write a program to input ,.any number and to check whether given number is Armstrong or not.(Armstrong 1,153,etc. 13 =1, 13+53 +33 =153)Answer:
n = inputfEnter the numberâ) savedn = n sum=0 while n > 0: a = n%10 sum = sum + a*a*a n = n/10 if savedn == sum: print savedn,âis an Armstrong Numberâ else: print savedn,âis not an Armstrong Numberâ
Question 5.Write a program to find all the prime numbers up to a given numberAnswer:
n = input("Enter the numberâ) i = 2 flag = 0 while (i < n): if (n%i)==0: flag = 1 print n,âis compositeâ break i = i+ 1 if flag ==0 : print n,âis primeâ
Question 6.Write a program to convert decimal number to binary.Answer:
i=1 s=0 dec = int ( raw_input(âEnter the decimal to be converted:â)) while dec>0: rem=dec%2 s=s + (i*rem) dec=dec/2 i=i*10 print âThe binary of the given number is:â,s raw_input()
Question 7.Write a program to convert binary to decimalAnswer:
binary = raw_input(âEnter the binary stringâ) decimal=0 for i in range(len(str(binary))): power=len (str (binary)) - (i+1) decimal+=int(str(binary)[i])*(2**power) print decimal
Question 8.Write a program to input two complex numbers and to find sum of the given complex numbers.Answer:
areal = input("Enter real part of first complex numberâ) aimg = input("Enter imaginary part of first complex numberâ) breal = input("Enter real part of second complex numberâ) bimg = input("Enter imaginary part of second complex numberâ) totreal = areal + breal totimg = aimg + bimg print âSum of the complex numbers=",totreal, â+iâ, totimg
Question 9.Write a program to input two complex numbers and to implement multiplication of the given complex numbers.Answer:
a = input("Enter real part of first complex numberâ) b = input("Enter imaginary part of first complex numberâ) c = input("Enter real part of second complex numberâ) d = input("Enter imaginary part of second complex numberâ) real= a*c - b*d img= a*d + b*c print âProduct of the complex numbers=",real, â+iâ,img
Question 10.Write a program to find the sum of all digits of the given number.Answer:
n = inputfEnter the numberâ) rev=0 while (n>0): a=n%10 sum = sum + a n=n/10 print âSum of digits=â,sum
Question 11.Write a program to find the reverse of a number.Answer:
n = input("Enter the numberâ) rev=0 while (n>0): a=n%10 rev=(rev*10)+a n=n/10 print âReversed number=â,rev
Question 12.Write a program to print the pyramid.12 23 3 34 4 4 45 5 5 5 5Answer:
for i in range(1,6): for j in range(1,i+1): print i, print
Question 13.Write a program to input username and password and to check whether the given username and password are correct or not.Answer:
import string usemame= raw_input(âEnter usernameâ) password = raw_input(âEnter passwordâ) if cmp(username.strip(),âXXXâ)== 0: if cmp(password,â123â) == 0: print âLogin successfulâ else: print âPassword Incorrectâ else: print âUsername Incorrectâ
Question 14.Write a generator function generatesq () that displays the squareroots of numbers from 100 to nwhere n is passed as an argument.Answer:
import math def generatesq (n) : for i in range (100, n) : yield (math, sqrt (i))
Question 15.Write a method in Python to find and display the prime number between 2 to n.Pass n as argument to the method.Answer:
def prime (N) : for a in range (2, N): for I in range (2, a): if N%i ==0 : break print a OR def prime (N): for a in range (2, N): for I in range (2, a) : if a%1= = 0 : break else : print a
Question 16.Write a program to input username and password and to check whether the given username and password are correct or not.Answer:
import string usemame= raw_input(âEnter usernameâ) password = raw_input(âEnter passwordâ) if cmp(usemame.strip(),âXXXâ)== 0: if cmp(password,â123â) == 0: print âLogin successfulâ else: print âPassword Incorrectâ else: print âUsername Incorrectâ
Question 17.Which string method is used to implement the following: [CBSE Text Book]
To count the number of characters in the string.
To change the first character of the string in capital letter.
To check whether given character is letter or a number.
To change lowercase to uppercase letter.
Change one character into another character.
Answer:
len(str)
str.title() or str.capitalize()
str.isalpha and str.isdigit()
lower(str[i])
str.replace(char, newchar)
Question 18.Write a program to input any string and to find the number of words in the string.Answer:
str = âHonesty is the best policyâ words = str.split() print len(words)
Question 19.Write a program to input n numbers and to insert any number in a particular position.Answer:
n=input(âEnter no. of values") num=[] for i in range (n): number=input(âEnter the number") num.append(number) newno = input(âEnter the number to be insertedâ) pos = input(âEnter positionâ) num.insert(newno,pos) print num
Question 20.Write a program to input n numbers and to search any number from the list.Answer:
n=input(âEnter no. of valuesâ) num=[] flag=0 for i in range (n): number=input(âEnter the numberâ) num. append(number) search = input(âEnter number to be searched") for i in range(n): if num[i]==search: print search,âfound at positionâ,i flag=1 if flag==0: print search, ânot found in listâ
Question 21.Write a program to search input any customer name and display customer phone numberif the customer name is exist in the list.Answer:
def printlist(s): i=0 for i in range(len(s)): print i,s[i] i = 0 phonenumbers = [â9840012345â,â9840011111â,â 9845622222â,â9850012345â,â9884412345â] flag=0 number = raw_input(âEnter the phone number to be searched") number = number.strip() try: i = phonenumbers.index(number) if i >= 0: flag=1 except ValueError: pass if(flag <>0): print â\nphone number found in Phonebook at indexâ, i else: print'\iphonenumbernotfoundin phonebookâ print â\nPHONEBOOKâ printlist(phonenumbers)
Question 22.Write a program to input n numbers and to reverse the set of numbers without using functions.Answer:
n=input(âEnter no. of valuesâ) num=[] flag=0 for i in range (n): number=input(âEnter the numberâ) num. append(number) j=n-1 for i in range(n): if i<=n/2: num[i],num[j] = num[j],num[i] j=j-1 else: break print num
Question 23.Find and write the output of the following Python code: [CBSE Complementry-2016]
class Client: def init (self, ID = 1, NM=âNonameâ) # constructor self.CID = ID self. Name = NM def Allocate (self, changelD, Title) : self.CID = self.CID + Changeld self.Name = Title + self. Name def Display (self) : print (self. CID). "#â, self. Name) C1 = Client () C2 = Client (102) C3 = Client (205, ââFedrickâ) C1 . Display () C2 . Display () C3 . Display () C2 . Allocate (4, "Ms.â) C3 .Allocate (2, "Mr.â) C1. Allocate (1, "Mrs.â) C1. Display () C2 . Display () C3 . Display ()
Answer:
CID Name â Fedrick 102 Mr. Fedrick 205 Mrs. Fedrick â Mr. & Mrs. Fedrick
Question 24.What will be the output of the following Python code considering the following set of inputs?
MAYA Your 5 Apples Mine2 412 Also, explain the try and except used in the code. Count = 0 while True : try: Number=int (raw input ("Input a Number :")) break Except valueError : Count=Count + 2 # For later versions of python, raw_input # Should be consider as input
mehtods:â DenCal () # Method to calcualte Density as People/Areaâ Add () # Method to allow user to enter values Dcode, DName, People, Area and Call DenCal () Mehtodâ View () # Method to display all the data members also display a message ââHigh Populationâif the Density is more than 8000.Answer:Output is below2 Re Enter Number10 Re Enter Number5 Input = Number3 Input = numberTry and except are used for handling exception in the Pythan code.
Question 25.Write a method in Python and display the prime numbers between 2 to N. Pass as argument to the methods.Answer:
def prime (N) : for a in range (2, N) Prime=1 for I in range (2, a): if a%i= = 0 : Prime = 0 if Prime = = 1: print a OR def prime (N) : for a in range (2, N): for I in range (2, a) : if a%i = = 0: break else : print a OR Any other correct code performing the same
Long Answer Type Questions (6 marks)
Question 1.Aastha wnats to create a program that accepts a string and display the characters in the reversein the same line using a Stack. She has created the following code, help her by completing thedefinitions on the basis of requirements given below:[CBSE SQP 2016]
Class mystack : def inin (self): selfe. mystr= # Accept a string self.mylist= # Convert mystr to a list # Write code to display while removing element from the stack. def display (self) : : :
Answer:
class mystack : def _init_ (self) : self.myster= rawjnput ("Enter the stringâ) self.mylist = list (self.mystr) def display (self) : x = len (self. mylist) if (x > 0) : for i in range (x) : print self.mylist.pop (), else : print "Stack is emptyâ
via Blogger https://ift.tt/3kkMk05
0 notes
Text
NCERT Class 12 Computer Science (Python) Solutions
NCERT Class 12 Computer Science (Python) Solutions :: CBSE Board
UNIT â I : OBJECT ORIENTED PROGRAMMING WITH PYTHON
Chapter 1 Review of Python
Chapter 2 Object Oriented Programming Concepts
UNIT â II : ADVANCE PROGRAMMING WITH PYTHON
Chapter 3 Lists Manipulation and Implementation
UNIT â III : DATABASES MANAGEMENT SYSTEM AND SQL
Chapter 4 Database Concepts
Chapter 5 Structured Query Language
UNIT â IV : BOOLEAN ALGEBRA
Chapter 6 Boolean Algebra
UNIT â V : NETWORKING & OPEN SOURCE SOFTWARE COMMUNICATION TECHNOLOGIES
Chapter 7 Networking and Open Source Concepts
via Blogger https://ift.tt/3knPOPB
0 notes
Text
NCERT Class 12 Computer Science Chapter 7 Networking and Open Source Concepts
NCERT Class 12 Computer Science Python Solutions for Chapter 7 :: Networking and Open Source Concepts
TOPIC-1
Communication TechnologiesVery Short Answer Type Questions (1 Mark each)
Question 1:Identify the Domain name and URL from the following:https://ift.tt/2Rc5dG8Answer:Domain name â income.inURL â https://ift.tt/2Rc5dG8.
Question 2:What is web hosting?Answer:Web hosting is the service that makes our website available to be viewed by others on the Internet. A web host provides space on its server, so that other computers around the world can access our website by means of a network or modem.
Question 3:Write two characterstics of Wi-Fi.Answer:
It is wireless network.
It is for short range.
Question 4:Which protocol is used to creating a connection with a remote machine?Answer:Telnet:Â It is an older internet utility that lets us log on to remote computer system. It also facilitates for terminal emulation purpose.
Question 1:Which protocol is used to create a connection to a remote machine? Give any two advantages of using optical fibers.Answer:Two advantage of using optical fibers are:
Capable of extremely high-speed.
No electromagnetic interference.
Extremely low attending.
Question 6:Expand the following:
GSM
GPRS
Answer:
GSM:Â Global System for Mobile Commu-nication.
GPRS:Â General Packet Radio Service.
Question 7:What is the difference between packet and message switching ?Answer:
Question 8:What is cloud computing?Answer:The sharing of compute resources (dedicated, time-shared, or dynamically shared servers) and related infrastructure components (load balncers, firewalls, network storage, developer tools, monitors and management tools) to facilitate the deployment and operation of web and network based applications. Cloud computing relies on sharing of resources to achieve coherence and economies of scale, similar to a utility (like the electricity grid) over a net-work.
Question 9:Which type of network (out of LAN, PAN and MAN) is formed, when you connect two mobiles using Bluetooth to transfer a video?Answer:PAN
Question 10:Write one characterstic each for 2G and 3G mobile technologies.Answer:2G networks primarily involve the transmission of voice information, 3G technology provides the additional advantage of data transfer.
Question 11:What is the difference between Packet switching and circuit switching techniques?Answer:In circuit switching, a dedicated path exists from source to destination while in packet switching, there is no fixed path.
Question 12:Write two advantages of using an optical fibre cable over an Ethernet cable to connect two service stations, which are 200 m away from each other.Answer:Advantages of optical fibre:
Faster speed than ethernet
Lower attenuation
Question 13:Write one advantage of bus topology of network. Also illustrate how four (4) computers can be connected with each other using bus topology of network.Answer:Advantage (benefits) of linear Bus topology is that the cable length required for this topology is the least compared to the other networks.Bus Topology of Network:
Question 14:Give one suitable example of each URL and Domain Name.Answer:URL: http://waltons.inDomain Name: @gmail.com
Question 15:Write one advantage of star topology network? Also, illustrate how five (5) computers can be connected to each other using star topology of network.Answer:Advantage (benefits) of star toplogy:Easy to replace, install or remove hosts or other devices.
Question 16:What is the function of Modem?Answer:The function of modem is modulation and demo-dulation, means turn data into a format that can be transmitted via an audio link such as a phone line.
Question 17:Explain the purpose of a router.Answer:A router established connection between two networks and it can handle network with different protocols. Using a routing table, routers make sure that the data packets are travelling through the best possible paths to reach their destination.
Question 18:Name any two components required for net-working.Answer:
Repeater
Routers
Question 19:What are repeaters?Answer:A repeater is an electronic device that receives a signal and retransmits it at a higher level and/ or higher power, or onto the other side of an obstruction, so that the signal can cover longer distances.
Question 20:Mention one advantage of star topology over bus topology in networking?Answer:Simple to add more computers to network.
Question 21:Differentiate between packet swiching and message switching technique in network commu-nication.Answer:In packet switched network, data are transmitted in discrete units of potentially variable length blocks called packets, while in message switching mechanism, a node receives a message stores it until the appropriate route is free, then sends it along.
Question 22:Differentiate between Bus and Star topology of network.Answer:
Question 23:What is VoIP?Answer:Voice over Internet Protocol (VoIP) is one of a family of internet technologies, communication protocols, and transmission technologies for delivery of voice communications and multi-media sessions over internet protocol (IP) network, such as the internet.
Question 24:In networking, what is WAN? How is it different from LAN?Answer:WAN (Wide Area Network):A communication network that uses such devices as telephone lines, satellite, dishes, or radiowaves to span a larger geographic area which cannot be covered by a LAN.
Question 25:Define the term bandwidth. Give any one unit of bandwidth.Answer:Bandwidth is referred as the volume of information per unit of time that a transmission medium (like an internet connection) can handle.ORThe amount of data that can be transmitted in a fixed amount of time is known as bandwidth. For digital devices, the bandwidth is usually expressed in bits per second (bps) or bytes per second. For analog devices, the bandwidth is expressed in cycles per second, or Hertz (Hz).
Question 26:What is the difference between LAN and MAN?Answer:LAN:Â It is Local Area Network. The diameter is not more than a single building.WAN:Â It is Metropolitan Area Network. LAN spans a few kms while MAN spans 5-50 km diameter and is larger than a LAN.
Question 27:What is the importance of URL in networking ?Answer:A Uniform Resource Locator (URL) is used to specify, where an identified resource is available in the network and the mechanism for retrieving it. A URL is also referred to as a web address. 1
Question 28:What was the role of ARPANET in the computer network?Answer:In 1969, ARPANET was set up by the American government for defence purpose. ARPANET stands for Advanced research Projects agency Network.
Question 29:Which of the following is not a unit for data transfer rate ?
bps
abps
gbps
kbps
Answer:(ii) abps
Question 30:Identify the type of topology from the following:
Each node is connected with the help of a single cable
Each node is connected with the help of independent cable with central switching.
Answer:
Bus topology
Star topology
Question 31:ABC International School is planning to connect all computers, each spread over a distance of 50 metres. Suggest an economic cable type having high speed data transfer to connect these computers.Answer:Optical fibre cable.
Question 32:Mahesh wants to transfer data within a city at very high speed. Write the wired transmission medium and type of network.Answer:Wired transmission medium â Optical fibre cable Type of network â MAN.
Question 33:Which device is used to connect all computers inside a lab?Answer:Hub
Question 34:Which device is used to connect all computers to the internet using telephone wire?Answer:RJ â 45. It is an eight wired connectors used to connect computers on a LAN.
Question 35:What is Wi-Fi Card?Answer:Wi-Fi cards are small and portable cards that allow the computer to connect to the internet through a wireless network. The transmission is through the use of radio waves.
Short Answer Type Questions
Question 1:Write any two differences between twisted pair and co-axial pair cable.Answer:
Question 2:Write one advantage of Bus Topology of network, also, illustrate how 4 computers can be connected with each other using star topology of network.Answer:Bus topology:Â Cable length required for his topology is the least compared to other networks.
Question 3:Explain any two switching techniques used in networking.Answer:Message Switching:Â It is similar to Post-office mailing system. A temporary link is established for one message transfer.Packet Switching:Â It is a form of store and forward switching system which stores the message as small packets at the switch nodes and then transmits it to the destination.
Long Answer Type Questions
Question 1:Write answer of the following:(a) Differentiate between PAN and LAN types of networks.(b) Which protocol helps us to transfer files to and from a remote computer ?(c) Write two advantages of 3G over 2G mobile telecommunication technologies in terms of speed and services.(d) Write two characteristics of Web 2.0(e) Write the basic difference between worm and Trojan Horse.(f) Categorize the following under client-side and server-side scripts category:
Jave Script
ASP
VB Script
JSP
(g)Intelligent Hub India is a knowledge community aimed to uplift the standard of skills and knowledge in the society. It is planning to setup its training centres in multiple towns and villages pan India with its head offices in the nearest cities. They have created a model of their network with a city, a town and 3 villages as given.As a network consultant, you have to suggest the best network related solution for their issues/problems raisedin (i) to (iv) keeping in mind the distance between various locations and given parameters.
Shortest distance between various locations:
Number of computers iinstalled at various locations are as follows:
Note:⢠In Villages, there are community centres, in which one room has been given as training center to this organization to install computers.⢠The organization has got financial support from the government and top IT companies.
Suggest the most appropriate location of the SERVER in the YHUB (out of the 4 locations), to get the best and effective connectivity. Justify your answer.
Suggest the best wired medium and draw the cable layout (location to location) to efficiently connect variÂŹous locations within the YHUB.
Which hardware device will you suggest to connect all the computers within each location of YHUB?
Which server/protocol will be most helpful to conduct live interaction of Experts from Head office and people at YHUB locations?
Answer:1.(a)OR(b)Â FTP or Telnet or TCPFTP OR Telnet OR TCP(c)Â Speed
Faster web browsing.
Faster file transferService â
Better video clarity
Better security
OR(Any other correct advantage can be considered)
(d)Â Makes web more interactive through online social media.Supports easy online information exchange.Interoperability on the internet.Video sharing possible in the websites.(e)
(f)
(g)(i) YTOWNJustification
Since it has the maximum number of computers.
It is closet to all other locatios.
(ii) Optical Fiber
(iii) Switch or Hub(iv) Video conferencing or VoIP or any other correct service/protocol.
Question 2:Indian School, in Mumbai is starting up the network between its different wings. There are four Buildings named as SENIOR, JUNIOR, ADMIN and HOSTEL as shown below:The distance between various buildings is as follows:Number of Computers in Each Building :
Suggest the cable layout of connections between the buildings.
Suggest the most suitable place (i.e., building) to house the server of this school, provide a suitable reason.
Suggest the placement of the following devices with justification.
Repeater
Hub/Switch
The organisation also has inquiry office in another city about 50-60 km away in hilly region. Suggest the suitable transmission media to interconnect to school and inquiry office out of the following :
Fiber optic cable
Microwave
Radiowave
Answer:
 Server can be placed in the ADMIN building as it has the maxium number of computer.
Repeater can be placed between ADMINand SENIOR building as the distance is more than 110 m.
Radiowaves can be used in hilly regions as they can travel through obstacles.
Question 3:Vidya Senior Secondary Public School in Nainital is setting up the network between its different wings. There are 4 wings named as SENIOR(S), JUNIOR(J), ADMIN(A) and HOSTEL(H).Distance between various wings are given below:
Suggest a suitable Topology for networking the computers of all wings.
Name the most suitable wing where the Server should be installed. Justify your answer.
Suggest where all should Hub(s)/Switch(es) be placed in the network.
Which communication medium would you suggest to connect this school with its main branch in Delhi ?
Answer:
Server should be in Wing S as it has the maxi-mum number of computers. 1
All Wings need hub/switch as it has more thanone computer.
Since the distance is more, wireless transmission would be better. Radiowaves are reliable and can travel through obstacles.
Question 5:
Which out ot three type of networks LAN. MAN and WAN, is to be used when an institute connects computers of two adjacent computer laboratories ?
What is the difference between HTTP and FTP?
What is the major difference between Message Switching and Packet Switching in networking?
What is the basic difference between DNS and URL?
Give two applications of web 2.0.
Categories the following under client side and Server-Side script category?
JSP
ASP
VBScript
Jave Script
Answer:(i)Â LAN (The ange is upto one KM)(ii)Â (iv)(v)Â Application of web 2.0
web hosting
web browsing
web Indexing
web searching
(vi)Â Client side Script
JSP
Java ScriptServer Side Scripts
ASP
VB Script
Question 6:Trine Tech Corporation (TTC) is a professional consultancy company. The company is planning to set up their new offices in India with its hub at Hyderabad. As a network adviser, you have to understand their requirement and suggest them the best available solutions. Their queries are mentioned as (i) to (iv) below.Physical Locations of the blocked of TTC
What will be the most appropriate block, where TTC should plan to install their server?
Draw a block to cable layout to connect all the buildings in the most appropriate manner for efficient communication.
What will be the best possible connectivity out of the following, you will suggest to connect the new setup of offices in Bangalore with its London based office:
Satellite Link
Infrared
Ethernet Cable
Which of the following device will be suggested by you to connect each computer in each of the buildings:
Switch
Modem
Gateway
Answer:
Finance block because it has maximumnumber of computers.
Satellite link
Switch
Question 7:G.R.K International Inc. is planning to connect its Bengaluru Office Setup with its Head Office in Delhi. The Bengaluru Office G.R.K. international Inc. is spread across and area of approx. 1 square kilometer, consisting of 3 blocks â Human Resources, Academics and Administration.You as a network expert have to suggest answers to the four queries (i) to (iv) raised by them.Notes : Keep the distance between blocks and number of computers in each block in mind, while providing them the solutions.
Suggest the most suitable block in the Bengaluru Office Setup, to host the server.Give a suitable reason with your suggestion.
Suggest the cable layout among the various blocks within the Bengaluru Office Setup forconnecting the Blocks.
Suggest a suitable networking device to be installed in each of the blocks essentially required for connecting computers inside the blocks with fast and efficient connectivity.
Suggest the most suitable media to provide secure, fast and reliable data connectivity between Delhi Head Office and the Bengaluru Office Setup.
Answer:
Human Resources because it has maximum number of computers.
Switch 1
Satellite link
Question 8:Rovenza Communications International (RCI) is an online corporate training provider company for IT related courses. The company is setting up their new compus in Kolkata. You as a network expert have to study the physical locations of various blocks and the number of computers to be installed. In the planning phase, provide the best possible answers for the queries (i) to (iv) raised by them.Block to Block Distances(in Mtrs.)Expected computers to be installed in each block
Suggest the most appropriate block, where RCI should plan to install the server.
Suggest the most appropriate block to block cable layout to connect all three blocks for efficient communication.
Which type of network out of the following is formed by connecting the computers of these three blocks?
LAN
MAN
 WAN
Which wireless channel out of the following should be opted by RCI to connect to students from all over the world?
Infrared
Microwave
Satellite
Write two advantages of using open source software over proprietary software.
Which of the following crime(s) does not come under cybercrime?
Copying some important data from a computer without taking permission from the owner of-the data.
Stealing keyboard and mouse from a shop.
Getting into unknown personâs social networking account and start messaging on his behalf.
Answer:
Faculty Recording Block.
Star topology
LAN
Satellite connection
Advantages of open source over proprietary software:
Open source softwareâs source code is available, can be modified copied & distributed while propritary software canât be change.
Open source is free while proprietary a paid.
(c) Stealing keyboard & mouse from a shop.4
Question 9:
Identify the type of topology on the basis ofthe following:
Since every node is directly connected to the server, a large amount of cable is needed which increases the installation cost of the network.
It has a single common data path connecting all the nodes.
Answer:
Star Topology
Bus Topology
(ii) Expand the following
VOIP
SMTP
Answer:
Voice Over Internet Protocol
Simple Mail Transder Protocol
(iii) Who is a hacker?
Answer:A computer enthusiast, who uses his computer programming skill to intentionally access a computer without authorization is known as hacker. A hacker accesses the computer without the intention of destroying data or maliciously harming the computer.(iv) The following is a 32 bit binary number usually represented as 4 decimal values, each representing 8 bits, in the range 0 to 255 (known as octets) separated by decimal points. 140.179.220.200What is it? What is its importance?Answer:It is an IP Address. It is used to identify the computers on a network.(v) Daniel has to share the data among various computes of his two offices branches situated in the same city. Name the network (out of LAN, WAN, PAN and MAN) which is being formed in this process.Answer:MAN(vi)Rehaana Medicos Center has set up its new center in Dubai. It has four buildings as shown in the diagram given below:
As a network expert, provide the best possible answer for the following queries:
Suggest a cable layout of connections betÂween the buildings.
Suggest the most suitable place (i.e. building) to house the server of this organization.
Suggest the placement of the following device with justification:
Repeater (b) Hub/Switch
Suggest a system (hardware/software) to prevent unauthorized access to or from the network.
Answer:
Layout 1
The most suitable place / building to house the server of this organization would be building Research Lab, as this building contains the maximum number of computers.
Since the cabling distance between Accounts to Store is quite large, so a repeater would ideally be needed along their path to avoid loss of signals during the course of data flow in this route.
Firewall.
Question 10:
What is the difference between domain nameand IP address?
Write two advantages of using an optical fibre cable over an Ethernet cable to connect two service stations, which are 190 m away from each other.
Expertfa Professsional Global (EPG) is an online, corporate training provider company for IT related courses. The company is setting up their new campus in Mumbai. You as a network expert have to study the physical locations of various buildings and the number of computers to be installed. In the planning phase, provide the best possible answer for the
Building to Building distances (in Mtrs.)
Suggest the most appropriate building, where EPG should plan to install the server.
Suggest the most appropriate building to building cable layout to connect all three buildings for efficient communication.
Which type of network out of the following is formed by connecting the computers of these three buildings?
LAN
MAN
WAN
Which wireless channel out of the following should be opted by EPG to connect to students of all over the world?
Infrared
Microwave
Satellite
Answer:
Domain Name is alphanumeric addressof a resource over network IP address is a Numeric Address of a resource in a Network.Example:Domain Name 1www.Gabsclasses.comIP Address102.112.0.153
Optical fibre Advantages:
Faster Communication.
Free from electrical & Noise interference.
(a) Faculty Studio Building(b) Bus Topology(c) LAN(d) Satellite
Question 11:To provide telemedicine faculty in a hilly state, a computer network is to be setup to connect hospitals in 6 small villages (VI, V2, âŚ, V6) to the base hospital (H) in the state capital. This is shown in the following diagram.
No village is more than 20 km away from the state capital.Imagine yourself as a computer consultant for this project and answer the following questions with justification:
Out of the following what kind of link should be provided to setup this network: Microwave link, Radio Link, Wired Link ?
What kind of network will be formed; LAN, MAN, or WAN ?
Many times doctors at village hospital will have to consult senior doctors at the base hospital. For this purpose, how should they contact them: using email, sms, telephone, or video conference ?
(b) Out of SMTP and POP3 which protocol is used to receive emails ?(c) What are cookies in the context of computer networks?(d) Rajeshwari is trying for on-line subscription to a magazine. For this she has filled in a form on the magazineâs web site. When the clicks submit button she gets a message that she has left e-mail field empty and she must fill it. For such checking which type of script is generally executed client side script or server-side script ?(e) Mention any one difference between free-ware and free software.
Answer:(a)
Radio Link
MAN
e-mail
(b) POP3(c) Cookies are files that store user information that is used to identify the user when he logs into the system.(d) Server-side script(e) Freeware is a software that has the user to get unlimited usage for. Free software may be free for a certain period only.
Question 12:Workalot Consultants are setting up a secured network for their office campus at Gurgaon for their day-to-day office and web-based activities. They are planning to have connectivity between three buildings and the head office situated in Mumbai. Answer the questions (i) to (iv) after going through the building positions in the campus and other details, which are given below :
Suggest the most suitable place (i.e., building) to house the server of this organization. Also give a reason to justify your suggested location.
Suggest a cable layout of connections between the buildings inside the campus.
Suggest the placement of the following devices with justification:
Repeater.
Switch.
The organization is planning to provide a high speed link with its head office situated in Mumbai using a wired connection. Which of the following cables will be most suitable for this job ?
Optical Fiber
Co-axial Cable
Ethernet Cable
Answer:
The most suitable place to install server is building âREDâ because this building have maximum computer which reduce communication delay.
(a) Since the cabling distance between buildings GREEN, BLUE and RED are quite large, so a repeater each, would ideally be need along their path to avoid loss of signals during the course of data flow in there routes.
(b) In the layout a switch each, would be needed in all the buildings, to interconnect the group of cables from the different computers in each building.
(iv) Optical fiber
Question 13:Granuda Consultants are setting up a secured network for their office campus at Faridabad for their day to day office and web based activities. They are planning to have connectivity between 3 building and the head office situated in Kolkata. Answer the questions (i) to (iv) after going through the building positions in the campus and other details, which are given below:
Suggest the most suitable place (i.e., block) to house the server of this organization. Also give a reason to justify your suggested location.
Suggest a cable layout of connections between the buildings inside the campus.
Suggest the placement of the following devices with justification:
Repeater
Switch
The organization is planning to provide a high speed link with its head office situated in the KOLKATA using a wired connection. Which of the following cable will be most suitable for this job?
Optical Fibre
Co-axial Cable
Ethernet Cable
Answer:
The most suitable place to install server is building âJAMUNAâ because this building have maximum computer which reduce the communication delay.
Cable layout. (Bus topology).
(a) Since the cabling distance between buildings GANGA and JAMUNA are quite large, so a repeater each, would ideally be needed along their path to avoid loss of signals during the course of data flow in these routes.(b) In the layout a switch each would be needed in all the building, to intercoÂŹnnect the group of cables from the different computers in each building.
Optical fiber
Question 14:India Skills Hub is a skill development community which has an aim to promote the standard of skills in the society. It is planning to set up its training centres in multiple towns and villages Pan India with its head offices in the nearest cities. They have created a model of their network with a city ABC Nagar, a town (UVW town) and 3 villages.As a network consultant, you have to suggest the best network related solutions for their issues/ problems raised in (i) to (iv), keeping in mind the distances between various locations and other given parameters.
Note:â In Villagers, there are community centers, in which one room has been given as training entrer to this organization to install computers.â The organization has got financial support from the government and top Multinational OrganiÂzations.
Suggest the most appropriate location of the SERVER in the Cluster (out of the 4 locations), to get the best and effective connectivity. Justify your answer.
Suggest the best wired medium and draw the cable layout (location to location) to efficiently connect various locations within the Cluster.
Which hardware device will you suggest to connect all the computers within each location of
Which service/protocol will be most helpful to conduct live interactions of Expersts from Head Office and peole at all locations of Cluster?
Answer:
Best location for the server is UVW-TOWN, because it is approximately equidistant from the village P, Q and R.
For connectivity between UVW-TOWN to head office is optic Fiber and to connect the villages, P, Q and R with server at UVW- TOWN is co-axial cable.
The villages R Q and R can be connected with server at UVW-TOWN by a Hub and the head office is connected by a Bus topology.
Between head office and UVWTOWNwe recommend for Bus topology, so HTTP protocol and other terminal can be connected by UDP or FTP protocols.
Question 15:Mudra publishing is a group of companies engaged in publishing IT related books located in the hilly area of Shimla. The companies are located in four different, blocks whose layout is shown in the following figure. Answer the questions (i) to (iv) with the relevant justifi-cations.Mudra publishing
Distance between various Blocks :
Block A to Block C is 50 m
Block A to Block D is 100 m
Block B to Block C is 40 m
Block B to Block D is 70 m
Block C to Block D is 125 mNumber of Computers
Block A is 25
Block B is 50
Block C is 20
Block D is 120
 Suggest a suitable network topology between the blocks.
Which is the most suitable block to house the server of this organization?
Suggest the placement of the following devices with justification
Repeater
Switch
The organization is planning to link the whole blocks to its marketing Office in Delhi. Since cable connection is not possible from Shimla, suggest a way to connect it with high speed.
Answer:
Suitable topology is bus topology.
The most suitable block for hosting server is BLOCK-D because this block has maximum number of computers.Mudra Publishing
Switch is a device used to segment network into different sub-networks so switch will exist in all the blocks. Since distance between BLOCK-D and BLOCK-C is large so repeater will be install between BLOCK-D and BLOCK-C.
The most economic way to connect it with a reasonable high speed would be the use radiowave transmission, as they are easy to install, can travel long distance and penetrate buildings easily, so they are used for communication, both indoors and outdoors. Radiowaves also have the advantage of being omni-directional. They can travel in all the directions from the source, so that the transmitter and receiver do not have to be carefully aligned physically.
 TOPIC-2Network Security and Web ServiceVery Short Answer Type Questions(1 Mark each)
Question 1:Define firewall.Answer:A system designed to prevent unauthorized access to or from a private network is called firewall, it can be implemented in both hardware and software or combination of both.
Question 2:Write any two examples of Server side Scripts.Answer:
ASP
PHP
Question 3:What is the difference between E-mail & chat?Answer:
Chat occurs in near real time, while E-mail doesnât.
Chat is a 2-way communication which require the permission of both parties, while E-mail is a 1-way communication.
Question 4:Write names of any two popular open source software, which are used as operating systems.Answer:
Kernels
Unix
Linux
Question 5:What is the difference between video conferencing and chat.Answer:In conference, we can include more than one person and it allows text video and audio while chat is one-to-one communication.
Question 6:Expand the following abbreviations :
HTTP
VOIP
Answer:
HTTP-Hyper Text Transfer Protocol.
VOIP-Voice Over Internet Protocol.
Question 7:What is the difference between HTTP and FTP?Answer:Hyper Text Transfer Protocol deals with Transfer of Text and Multimedia content over internet while FTP (File Transfer Protocol) deals with transfer of files over the internet.
Question 8:What out of the following, will you use to have an audio-visual chat with an expert sitting in a far-away place to fix-up a technical issue ?
VoIP
email
FTP
Answer:(i) VoIP 1
Question 9:Name one server side scripting language and one client side scripting language.Answer:Client Side :
JAVASCRIPT
VBSCRIPTServer Side
ASP
JSP
Question 10:Which out of the following comes under cyber crime ?
Operating someoneâs internet banking account, without his knowledge.
Stealing a keyboard from someoneâs computer.
Working on someoneâs Computer with his/ her permission.
Answer:(i) Operating someoneâs internet banking account, without his knowledge.
Question 11:Name two proprietary software along with their application.Answer:
MS-Office â All office applications MS-Word, MS-Excel, MS-PowerPoint.
Visual Studio â Visual Basic, Visual C+ +software for application development.
Question 12:Out of the following, identify client side script (s) and server side script (s).
ASP
Javascript
VBScript
JSP
Answer:Server side scripting
ASP
JSPClient side scripting
Javascript
VBscript Vi
Question 13:Compare open source software and proprietary software.Answer:One need an authorized license paid in order to use this proprietary software while open sourcesoftware can be used by anybody and are usually free. One can use this software for their personal use. After giving any notation or code in this type one cannot change the code or modify it.
Question 14:Differentiate between XML and HTML.Answer:
Question 15:What is WEB 2.0 ?Answer:Web2.0 refers to the new generation of web based services and communities characterised by participation, collaboration and sharing of information among users online.
Question 16:Which of the following is/are not a client side script:
VB Script
Java Script
ASP
PHP ?
Answer:(iii) ASP and(iv) PHP are not client side scripts.
Question 17:If someone has hacked your website, to whom you lodge the complaint ?Answer:The complaint has to be lodged with the police under IT Act.
Question 18:What do you mean by IP address? How is it useful in computer security ?Answer:An Internet Protocol (IP) address is a numerical identification and logical address that is assigned to devices connected in a computer network.An IP address is used to uniquely identify devices on the internet and so one can quickly know the location of the system in the network. 1
Question 19:What do you mean by spam mails ? How can you protect your mailbox from spams ?Answer:Spam mails, also known as junk e-mail, is a subset of spam that involves nearly identical messages sent to numerous recipients by e-mail.We can protect our mailbox from spams by creating appropriate filters.
Question 20:When do you prefer XML over HTML and why ?Answer:The first benefit of XML is that because you are writing your own markup language, you are not restricted to a limited set of tags defined by proprietary vendors.Rather than waiting for standards bodies to adopt tag set enhancements (a process which can take quite some time), or for browser companies to adopt each otherâs standards with XML, you can create your own set of tags at your own place.
Question 21:How does firewall protect our network ?Answer:A firewall is a part of a computer system or network, that is designed to block unauthorized access while permitting authorized communi-cations. It is a device or set of devices configured to permit, deny, encrypt, decrypt, or proxy all (in and out) computer traffic between different security domains based upon a set of rules and, other criteria. 1
Question 22:Compare freeware and shareware.Answer:Freeware, the name derived from the words âfreeâ and âsoftwareâ. It is a computer software that is available for use at no cost or for an optional fee. Freeware is generally proprietary software available at zero price, and is not free software. The author usually restricts one or more rights to copy, distribute, and make derivative works of the software.Shareware is usually offered as a trial version with certain features only available after the license is purchased, or as a full version, but for a trial period. Once the trial period has passed, the program may stop running until a license is purchased. Shareware is often offered without support, updates, or help menus, which only become available with the purchase of a license. The words âfree trialâ or âtrial versionâ are indicative of shareware.
Question 23:How trojan horses are different from worms? Mention any one difference.Answer:A trojan horse is a term used to describe malware that appears to the user, to perform a desirable function but, in fact, facilitates unauthorized access, to the userâs computer system.A computer worm is a self-replicating computer program. It uses a network to send copies of itself to the other nodes (computers on the network) and it may do so without any user intervention.
Question 24:Give the full form of :
FOSS
HTTP
Answer:
FOSS :Â Free Open Source Software.
HTTP :Â Hyper Text Transfer Protocol.
Question 25:What is the difference between trojan horse and virus in terms of computers ?Answer:A trojan, sometimes referred to as a trojan horse, is non-self-replicating malware that appears to perform a desirable function for the user but instead facilitates unauthorized access to the userâs computer system. The term is derived from the trojan horse story in greek mythology.A computer virus is a computer program that can copy itself and infact a computer. A true virus can only spread from one computer to another.The chief difference between a trojan horse and a virus is that a trojan horse does not replicate itself. A virus does. 1
Question 26:Which term we use for a software/hardware device, which is used to block, unauthorized access while permitting authorized communiÂŹcations. This term is also used for a device or set of devices configured to permit, deny, encrypt, decrypt, or proxy all (in and out) computer traffic between different security domains based upon a set of rules and other criteria.Answer:Firewall.
Question 27:Write the full forms of the following:
GNU
XML
Answer:
GNU stands for âGNUâs Not Unixâ
XML stands for âExtensible Markup Languageâ.
Question 28:Expand the following terminologies:
GSM
WLL (IMP)
Answer:
GSM: Global System for Mobile Communication
WLL: Wireless Local Loop.
Question 29:Name some cyber offences under the IT Act.Answer:
Tampering with computer source documents
Hacking.
Publishing of information which is obscenein electronic form.
Question 30:What are the three ways of protecting intellectual property ?Answer:
Patents
Copyrights
Trademark
Question 31:When a user browses a website, the web server sends a text file to the web browser. What is the name of this?Answer:Cookies.
Short Answer Type Questions
Question 1:Define the following:
Firewall
VoIE
Answer:
Firewall:Â A system designed to preventunauthorized access to or from a private network is called firewall, it can be implemented in both hardware and software or combination of both.
VoIP:Â Voice-over-Internet Protocol(VoIP) is a methodology and group of technologies for the delivery of voice communications and multimedia sessions over Internet Protocol (IP) networks, such as the Internet.
Question 2:Give the full form of the following terms.
XML
FLOSS
HTTP
FTP
Answer:
XML:Â Extensible Markup Language.
FLOSS:Â Free-Libre Open Source Software.
HTTP:Â Hyper Text Transfer Protocol.
FTP:Â File Transfer Protocol.
Question 3:Differentiate between WORM and VIRUS in Computer terminology.Answer:VIRUS directly effects the system by corrupting the useful data. A computer virus attaches itself to a program or file enabling it to spread from one computer to another.A WORM is similar to a virus by design is considered to be subclass of a virus. Worm spread from computer to computer, but unlike a virus, it has the capability to travel without any human action. 2
Question 4:Expand the following
GSM
GPRS.
Answer:
GSM:Â Global System for Mobile Communi-cation.
GPRS:Â General Packet Radio Service.
Question 5:Expand the following abbreviations :
HTTP
VOIP
Answer:
HTTP:Â Hyper Text Transfer Protocol.
VOIP:Â Voice Over Internet Protocol.
Question 6:Give the full form of :
FOSS
HTTP
Answer:
FOSS:Â Free Open Source Software.
HTTP:Â Hyper Text Transfer Protocol.
Question 7:Write the full forms of the following :
GNU
XML
Answer:
GNU:Â GNUâs Not Unix
XML:Â Xtensible Markup Language.
Question 8:Expand the following terminologies :
GSM
WLL
Answer:
GSM:Â Global System for Mobile Communi-cation
WLL:Â Wireless Local Loop.
Question 9:Give the full forms of the following terms :
CDMA
TDMA
FDMA
Answer:
CDMA:Â Code Division Multiple Access
TDMA:Â Time Division Multiple Access
FDMA:Â Frequency Division Multiple Access
Question 10:Expand the following abbreviations :
FTP
TCP
SMTP
VOIP
Answer:
FTP:Â File Transfer Protocol
TCP:Â Transmission Control Protocol.
SMTP:Â Simple Mail Transfer Protocol.
VOIP:Â Voice Over Internet Protocol
via Blogger https://ift.tt/3bZDUs4
0 notes